Aw: [xsl] escape quotation marks in regular expression

Subject: Aw: [xsl] escape quotation marks in regular expression
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 10 Jul 2022 06:00:20 -0000
Did you try without the backslash?

--
Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail
gesendet.Am 10.07.22, 07:52 schrieb "Wolfhart Totschnig
wolfhart.totschnig@xxxxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>:

  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:

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

  But Saxon throws the following error:

  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

XSL-List info and archiveEasyUnsubscribe (by email)

Current Thread