Andrey Finkelman
Andrey Finkelman

Reputation: 1

How to replace special characters as "{" in xquery?

I'm trying to remove '}{' by '},{' in xquery:

fn:replace($text,'\\}\\{','\\},\\{')

and getting an error:

org.apache.xmlbeans.impl.regex.ParseException: Unexpected meta character

Upvotes: 0

Views: 3270

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167706

Seems simple:

replace($text, '\}\{', '},{')

https://xqueryfiddle.liberty-development.net/nbUY4kv

If there can be whitespace between the curly braces you can use

replace($text, '\}\s*\{', '},{')

https://xqueryfiddle.liberty-development.net/nbUY4kv/3

Upvotes: 1

Related Questions