Project

Profile

Help

Bug #6426

closed

fn:matches surprisingly returns false for fn:matches("AB", "^(.*)+B")

Added by Michael Kay 7 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
2024-05-15
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

From: https://github.com/w3c/qt3tests/issues/59

With Saxon, fn:matches("AB", "^(.*)+B") returns false, and I don't understand why. I've ported Saxon's regex engine to Rust, and I'm also getting a false here (once I fixed another bug), which surprised me, so I verified that Saxon does the same.

Looking at it, the .* should consume "A", and then "B" should be matched. But it doesn't do that.

On regex101 all the flavors have it match https://regex101.com/r/JfmqWf/1

I'm trying to understand why it wouldn't match for the XPath regex flavor. And whether it should match or not, I think it's worthwhile adding a test case to the test suite to nail this behavior down.

This behavior is implemented inside of the Repeat op, for greedy matching. I suspect it's in advance() (in the Java code). I see a bug was fixed previously (3787).

Please register to edit this issue

Also available in: Atom PDF