-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] replace, tokenize and analyze-string must throw when pattern matches an empty string #3803
Comments
This might be a change in behaviour again. replace("$11.23", "^[^0-9]*(.*)$", "$1") is the correct form to write the replacement. |
Looking at it again, I am unsure. This looks like a bug. But
|
So |
related #3530 |
BaseX 9.5 will raise error |
Saxon 10.0 (HE) also throws the same error. |
@PieterLamers would you or may I edit the bug description to reflect the new findings? Or should I open a separate one? |
Hi @line-o , thanks for the explanations! You are welcome to edit the ticket. I think I will simply replace the * by a + to avoid the error. |
…RX0003 when pattern matches an empty string Closes eXist-db#3803
…RX0003 when pattern matches an empty string Closes eXist-db#3803
…RX0003 when pattern matches an empty string Closes eXist-db#3803
…RX0003 when pattern matches an empty string Closes eXist-db#3803
…RX0003 when pattern matches an empty string Closes eXist-db#3803
Describe the bug
fn:replace
,fn:tokenize
andfn:analyze-string
allow to use a pattern that matches an empty string. That results in odd behaviour as in this example:The provided pattern does always match because it matches the empty string.
Expected behavior
Error FORX0003 is thrown with location information
Actual
The first character is swallowed:
2.34
To Reproduce
or
will return
2.34
instead of the desired12.34
Reference
This used to have a different behaviour in earlier versions of existdb where a pattern that matched an empty string would just return the input unchanged (likely related to #3530).
fn:replace specification
XQTS 31 tests
Context (please always complete the following information):
The text was updated successfully, but these errors were encountered: