Regular Expression 'P{Ll}' raises error [FORX0004] Regular expression: 'Lexical error at line 1, column 3. Encountered: "L" (76), after : "{"'.

Tuesday, 25 September 2012 · 4 messages
LW
Leo Wörtelerin reply to Alex Muir, 25 Sep 2012, 17:4525 Sep 2012 16:42 #
Hi Alex,
Quoted text · Alex Muir · 7 lines
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".
Quoted text · Alex Muir · 6 lines
> 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
LW
Leo Wörtelerin reply to Alex Muir, 25 Sep 2012, 19:0025 Sep 2012 17:33 #
Alex,
Quoted text · Alex Muir · 11 lines
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.html
AM
Alex Muir25 Sep 2012 17:45 #
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: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 "\". Let me know your thoughts Regards
-- - Alex G. Muir Software Engineering Consultant Linkedin Profile : http://ca.linkedin.com/pub/alex-muir/36/ab7/125 Love African Kora Music? Take a moment to listen to Gambia's Amadu Diabarte & Jali Bakary Konteh www.bafila.bandcamp.com your support keeps Africa's griot tradition alive... Cheers!
AM
Alex Muirin reply to Leo Wörteler, 25 Sep 2012, 16:4225 Sep 2012 19:00 #
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 .
Quoted text · Leo Wörteler · 30 lines
On Tue, Sep 25, 2012 at 10:42 AM, Leo Wörteler <lw at 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 G. Muir Software Engineering Consultant Linkedin Profile : http://ca.linkedin.com/pub/alex-muir/36/ab7/125 Love African Kora Music? Take a moment to listen to Gambia's - Amadu Diabarte & Jali Bakary Konteh www.bafila.bandcamp.com Your support keeps Africa's griot tradition alive... Cheers!

⚡Generated with XQuery