https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88947

--- Comment #7 from Tomalak Geret'kal <tom at kera dot name> ---
(In reply to Tim Shen from comment #5)
> For the original test case, have you tried regex_match() with "what.*"?

That behaves as I'd expect
(http://quick-bench.com/AKdMnnhA03T1vwfN9sf53xlbD6s).

> Do you have any non-trivial testcase in mind that is still unexpectedly slow
> with regex_match()?

The original real-world pattern that led to me discovering this was:

/^[\x02-\x7f]\0..[\x01-\x0c]\0..\0\0/

Switching to regex_match() for that pattern also yields the expected result
(http://quick-bench.com/g6lZj00gBswzvd-rjO7QwRE0Exg), so that's a good
workaround here.

But, adapting your earlier example to "(^abc|xyz)", this would require chaining
a regex_match with a regex_search, which gets unwieldy quite quickly.

Well, okay, I suppose in that example we could regex_match on
"(?:(abc).*|.*(xyz).*)", but I really don't think we should have to rewrite
patterns like this in order to get the behaviour that's common in other
ecosystems' regex impls. So, although I'm open to being convinced otherwise, I
still think we would reasonably expect regex_search to fail fast.

Reply via email to