Project

Profile

Help

Bug #3782

closed

matches('k123', '(^|:)?(\d)') returns false

Added by Michael Kay almost 6 years ago. Updated over 5 years ago.

Status:
Won't fix
Priority:
Normal
Assignee:
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
2018-05-15
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
9.8, trunk
Fix Committed on Branch:
trunk
Fixed in Maintenance Release:
Platforms:

Description

The expression

matches('k123', '(^|:)?(\d)')

returns false.

Reported by Nico Kutscherauer @nkutsche on Twitter.

Actions #1

Updated by Michael Kay almost 6 years ago

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.

Actions #2

Updated by Michael Kay almost 6 years ago

  • 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.

Actions #3

Updated by Michael Kay almost 6 years ago

  • 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.

Actions #4

Updated by Michael Kay over 5 years ago

  • Description updated (diff)

Please register to edit this issue

Also available in: Atom PDF