Index: head/lib/libc/regex/regcomp.c =================================================================== --- head/lib/libc/regex/regcomp.c +++ head/lib/libc/regex/regcomp.c @@ -672,7 +672,7 @@ bc.terminate = false; if (p->pre_parse != NULL) p->pre_parse(p, &bc); - while (MORE() && !SEESPEC('|') && !SEEEND()) { + while (MORE() && (!p->allowbranch || !SEESPEC('|')) && !SEEEND()) { bc.terminate = p->parse_expr(p, &bc); ++bc.nchain; }