I have the following XML tag
I want to replace the <
in the text with <
>
@duncan's method works fine if you just want to replacing, but it doesn't match the <
.
and all the lookbehind wont work if you a using javascript. because javascript doesn't support lookbehind, unless you turn on the --harmony
flag in nodejs or experimental javascript features in chrome.
But lookahead will work here, which is:
/(?!^)
will match the <
which is not at the begining of a line.
and the replacing will be:
'
'.replace(/(?!^), '<')