Hi,
I find that a regualr expression below
let $regex := 'P{Ll}'
let $input := .//subsection[matches(@title,$regex)]
causes the error [FORX0004] Regular expression: 'Lexical error at line 1, column 3. Encountered: "L" (76), after : "{"'.
I use P{Ll} in xslt/xpath in saxon without issue and I'm running basex with saxon so I assume this is something basex is parsing out as an error condition
I looked in the xquery spec for the error and found which seems to be something else An error is raised [err:FORX0004http://www.w3.org/TR/xpath-functions-30/#ERRFORX0004] if the value of $replacement contains a "$" character that is not immediately followed by a digit 0-9 and not immediately preceded by a "".
Let me know your thoughts Regards
Hi Alex,
Am 25.09.2012 15:45, schrieb Alex Muir:
let $regex := 'P{Ll}'
let $input := .//subsection[matches(@title,$regex)]
causes the error [FORX0004] Regular expression: 'Lexical error at line 1, column 3. Encountered: "L" (76), after : "{"'.
I think you missed a backslash, the category escape matching non-lowercase characters is '\P{Ll}'. Without the backslash, the braces are interpreted as a quantifier [1], which expects a number instead of "L".
I looked in the xquery spec for the error and found which seems to be something else An error is raised [err:FORX0004 http://www.w3.org/TR/xpath-functions-30/#ERRFORX0004] if the value of |$replacement| contains a "|$|" character that is not immediately followed by a digit |0-9| and not immediately preceded by a "".
You are correct, the wrong error code is used. It should be FORX0002 (invalid regular expression, [2]) instead. I'll fix that soon.
Cheers, Leo
[1] http://www.w3.org/TR/xmlschema11-2/#nt-quantifier [2] http://www.w3.org/TR/xpath-functions-30/#ERRFORX0002
Leo,
oops..
I had copied that incorrectly from a much larger regex which contained (\s+\P{Ll}{3,280}?) and was giving an exception.
Actually I just noticed that the exception I was getting prior to copying was
[FORX0004] Regular expression: 'Illegal quantifier, lower > upper bound: {3,2}'
related to {3,280} if I change it to {3,80} the exception goes away
Thanks Alex .
On Tue, Sep 25, 2012 at 10:42 AM, Leo Wörteler lw@basex.org wrote:
Hi Alex,
Am 25.09.2012 15:45, schrieb Alex Muir:
let $regex := 'P{Ll}'
let $input := .//subsection[matches(@title,$regex)]
causes the error [FORX0004] Regular expression: 'Lexical error at line 1, column 3. Encountered: "L" (76), after : "{"'.
I think you missed a backslash, the category escape matching non-lowercase characters is '\P{Ll}'. Without the backslash, the braces are interpreted as a quantifier [1], which expects a number instead of "L".
I looked in the xquery spec for the error and found which seems to be something else An error is raised [err:FORX0004 http://www.w3.org/TR/xpath-functions-30/#ERRFORX0004] if the value of |$replacement| contains a "|$|" character that is not immediately followed by a digit |0-9| and not immediately preceded by a "".
You are correct, the wrong error code is used. It should be FORX0002 (invalid regular expression, [2]) instead. I'll fix that soon.
Cheers, Leo
[1] http://www.w3.org/TR/xmlschema11-2/#nt-quantifier [2] http://www.w3.org/TR/xpath-functions-30/#ERRFORX0002
Alex,
Am 25.09.2012 17:00, schrieb Alex Muir:
I had copied that incorrectly from a much larger regex which contained (\s+\P{Ll}{3,280}?) and was giving an exception.
Actually I just noticed that the exception I was getting prior to copying was
[FORX0004] Regular expression: 'Illegal quantifier, lower > upper bound: {3,2}'
related to {3,280} if I change it to {3,80} the exception goes away
this is a known bug [1] that was reported earlier this month [2]. Sorry for the inconvenience, we'll look into it as soon as possible.
Leo
[1] https://github.com/BaseXdb/basex/issues/573 [2] https://mailman.uni-konstanz.de/pipermail/basex-talk/2012-September/003814.h...
basex-talk@mailman.uni-konstanz.de