Avatar of rusdemezale
rusdemezale
Flag for Iceland

asked on 

replace a set of characters with another set of chars: "&", "&" "<", "<" etc. in regex, but simultaneously

I have to encode the 5 XML reserved chars (& < > " and ') properly as follows:
"&", "&amp;"
"<", "&lt;"
">", "&gt;"
"\"", "&quot;"
"\'", "&apos;"
I can do them one by one, but is it possible in regexp something like ("[&|<|>|\"|\']", "&amp;|&lt;"); ... etc so that it will not be executed in 5 operations one after another but alltogether simultaneously?
Regular Expressions

Avatar of undefined
Last Comment
rusdemezale

8/22/2022 - Mon