Inconsistency of regular expression support in BaseX and GUI
Saturday, 30 July 2016 · 2 messages · last reply 3 Aug 2016
KK
Kristian Kankainen30 Jul 2016 12:12 #
Hello!
Today I noticed that I can successfully use the following regular expression inside XQuery but the same regexp fails when using it in the GUI's searchboxes (the ones appearing when pressing Ctrl+F) when enabling regular expression search.
This is the regular expression and probably it is the block escape that is causing the error:
(¹|²|³|\p{IsSuperscriptsandSubscripts})
The error message says:
"Regular Expression: java.util.regex.PatternSyntaxException: Unknown character property name {issuperscriptsandsubscripts} near index 37"
Probably the lowercaseing of the block escape name is causing the error and hopefully it can be fixed without too complex logics.
Best regards
Kristian K
CG
Christian Grün3 Aug 2016 23:02 #
Hi Kristian,
You are right: The text panels of the BaseX GUI provide support for regular Java regex expressions, which are indeed different to the XQuery semantics. It would be pretty difficult to rewrite the text components for XQuery regex support; but I’ll have some more thought on this.
Cheers
Christian
Quoted text · Kristian Kankainen · 26 lines
On Sat, Jul 30, 2016 at 12:12 PM, Kristian Kankainen <kristian at keeleleek.ee> wrote: > Hello! > > Today I noticed that I can successfully use the following regular expression > inside XQuery but the same regexp fails when using it in the GUI's > searchboxes (the ones appearing when pressing Ctrl+F) when enabling regular > expression search. > > This is the regular expression and probably it is the block escape that is > causing the error: > > (¹|²|³|\p{IsSuperscriptsandSubscripts}) > > The error message says: > > "Regular Expression: java.util.regex.PatternSyntaxException: Unknown > character property name {issuperscriptsandsubscripts} near index 37" > > Probably the lowercaseing of the block escape name is causing the error and > hopefully it can be fixed without too complex logics. > > Best regards > > Kristian K >
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery