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 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!