Bug #3782
closed
matches('k123', '(^|:)?(\d)') returns false
Category:
XPath conformance
Applies to branch:
9.8, trunk
Fix Committed on Branch:
trunk
Fixed in Maintenance Release:
Description
The expression
matches('k123', '(^|:)?(\d)')
returns false.
Reported by Nico Kutscherauer @nkutsche on Twitter.
The issue seems to be that (^|:)?
is being optimized to (^|:)
because matchesEmptyString()
is true. I think we've hit something like this before -- we want to know that a zero-length match is possible, but we don't want to assume that the expression matches EVERY zero-length string.
- Status changed from New to In Progress
- Applies to branch 9.8, trunk added
- Fix Committed on Branch trunk added
I have fixed this on the development branch by refining the method matchesEmptyString() to return a set of values indicating whether a regex (subexpression) matches a zero-length string occurring at the start, at the end, or anywhere, and doing this optimization only if it matches a ZLS anywhere.
As the changes are somewhat extensive and therefore have a relatively high risk of causing regression I'm going to hold back from applying the change on the 9.8 branch, at least for now.
Added QT3 test case fn-matches-54 (which 9.8 is currently failing)
Note: bug 3712 is related, in that it's a similar flaw in the optimization logic.
- Status changed from In Progress to Won't fix
Marking as "won't fix" as the best way of indicating that we are leaving it unresolved on the 9.8 branch.
- Description updated (diff)
Please register to edit this issue
Also available in: Atom
PDF