Sublime Forum

Yaml converter for syntax, & character problem

#1

Hi,
i’m tring the builder for yaml to convert yaml-tmlanguage to tmlanguage but i found a big problem in character conversion.

in all my regex the & character is converted to & indipendenty by being wrapped in ‘’ or not

How i can escape & character in this regex?
I must edit it manually after it has been generated?

0 Likes

#2

The target file format is a property list, which is based on XML. Characters like > and < need to be escaped - as HTML entities (&gt;) . For that reason, & must be escaped as well.

Does the converted syntax not work?

0 Likes

#3

ok thanks for the answer. the problem that i wrote the syntax for jstl and the operator && or escaping the escape characters (>) genarate a not valid regex format.
Example:

i have this regex in my yaml-tmlanguage
(&lt;)(\/)([a-zA-Z0-9^\ ]*?)(:.*?)(&gt;)

when converting it output:
(&amp;lt;)(\/)([a-zA-Z0-9^\ ]*?)(:.*?)(&amp;gt;)

and broke the regex.

ok a solution is using directly < and > in yaml-tmlanguage.

but the & character shouldn’t have any impact on xml structure i think, so i don’t understand the necessity to replace it.

0 Likes

#4

It is used to escape > and <, so on order to remain unambiguous a normal & has to be escaped as well.

0 Likes