0

I would like to add the following rule in my urlrewrite.xml (Lucee server):

<from>^([a-zA-Z0-9\/\-\%\+:\[\]\{\}\|\;\<\>\?\,\*\!\@\#\$\ \(\)\^_`~]*)$</from>
<to type="passthrough">/index.cfm?furl=$1</to>

but unfortunately i receive an error regarding < character. For your better assistance, i attach the following image:

enter image description here

Any idea that could help me?

Regards

asimkon
  • 915
  • 1
  • 14
  • 21
  • Does this answer your question? [What are invalid characters in XML](https://stackoverflow.com/questions/730133/what-are-invalid-characters-in-xml) – Enigmativity Jun 08 '21 at 06:30
  • You have one large character set definition set inside square brackets [ ] and you are escaping lots of charachters inside, such as dot, asterisk and many more. MetaCharacters inside character sets are very different from the ones ouside: Only MetaCharacters that need to be escaped are the closing bracket ], the backslash \ and the caret ^. All others are considered being natural characters, hence you won't need to escape all of these. Please see "Metacharacters Inside Character Classes" in https://regular-expressions.mobi/charclass.html?wlr=1 – AndreasRu Jun 08 '21 at 06:36
  • Yes your article was indeed very helpful for invalid XML characters. Thanks – asimkon Jun 08 '21 at 11:11

1 Answers1

0

You're putting invalid characters in your XML value.

This is what it should be:

<from>^([a-zA-Z0-9\/\-\%\+:\[\]\{\}\|\;\&lt;\&gt;\?\,\*\!\@\#\$\ \(\)\^_`~]*)$</from>

These characters need to be escaped in XML:

&
'
"
<
>

See: https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML

Enigmativity
  • 113,464
  • 11
  • 89
  • 172