| Summary: | Inconsistent output compared with other JS engines when using RegExp.prototype.exec() | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Yeting Li <liyeting> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | karlcow, mark.lam, msaboff, webkit-bug-importer |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Is there a webpage that has a webpage with a RegExp with this pattern?
The regex in question fails in the JSC RegExp JIT due to running out of memory for handling the greedy parenthesis backtracking and then the iRegExp interpreter tries the match exceeding the 1,000,000 maximum disjunction match count.
If the RegExp is minimum count for the word character is changed from 0 to 1, the match succeeds in the JIT. e.g. regex=/([A-z]?\w{1,7})+(?:\1)/
There still may be a bug here. I will investigate further.
|
Hello, The code below does not have the same behavior as other engines (e.g., V8 in Google Chrome and SpiderMonkey in Firefox). var regex=/([A-z]?\w{0,7})+(?:\1)/ console.log(regex.exec("DzVoQoowXSmB5QNFySmB5QNFy")) In JavaScriptCore, the output is null However, in V8 and SpiderMonkey, output is ["DzVoQoowXSmB5QNFySmB5QNFy", "SmB5QNFy"] Best, Yeting Li