Hi,

The positive lookahead regular expression which I have constructed
below throws  the following error

[1.0-ml] XDMP-REGEX: (err:FORX0002)
fn:replace("(search:"good") OR (search:"this(world) is
good&q...", "\)(?=([^"]*["][^"]*["])*[^"]*$)",
"") -- Invalid regular expression

The Regex is

let $str := '(search:"good") OR (search:"this(world) is good") OR
(search:"world")'
return fn:replace(fn:replace($str,'\)(?=([^"]*["][^"]*["])*[^"]*$)',
""),'\((?=([^"]*["][^"]*["])*[^"]*$)', "")

Expected result >> search:"good" OR search:"this(world) is good" OR
search:"world"

Basically I'm trying to remove the open and closed brackets withing
the string but wanted them to be excluded if enclosed within double
quotes.

How to achieve positive lookahead using regex in Xquery?

Thanks,
Blessing.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to