[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

escape quotation marks in regular expression

Subject: escape quotation marks in regular expression
From: "Wolfhart Totschnig wolfhart.totschnig@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 10 Jul 2022 05:51:48 -0000
 escape quotation marks in regular expression
Dear list,

I am receiving strings that may or may not be wrapped in double quotation marks. I would like to remove the quotation marks at the start and end of the string, if there are. There may also be quotation marks in the middle of the string, which should not be removed. I thought to use the replace() function for this, like so:

B B B select="replace(., '^\&quot;?(.+)\&quot;?$', '$1')"

But Saxon throws the following error:

B B B FORX0002: Syntax error at char 3 in regular expression: Escape character '"' not allowed

So what do I have to put instead of "\&quot;"? That is, what is the correct way to escape the quotation marks in the regular expression?

(I am aware that I could do this without a regular expression, i.e., with substring() and string-length(), but I would like to know how to do it with replace() since that seems simpler.)

Thanks in advance for your help!

Wolfhart

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.