I have an XML-based scripting language where I want to use something like <example if="x<5" />
The <
is an illegal character for attributes, so XML parsers throw errors.
I still like to use it without escaping, it's nicer for humans to read and write x<=5
than x<=5
.
So I'd like to pre-process the XML before it's being parsed and replace the invalid <
with <
But I can't figure out a regex. I've been trying for two hours now.
I've come as far ="(.*?)"
to match everything in an attribute, but I just want that damn <
and ="(<)"
doesn't do it.