I need to replace & by & in only those instances of my input string where & is standalone and not followed by amp; .
For example:
1.If input is
"123&4567&"
Output after replace should be:
"123&4567&"
2.If input is
"123&45&67&"
Output after replace should be:
"123&45&67&"
How do I achieve this using C#/Regex?
Thanks.
Use a negative lookahead. In C# Regex, if I’m not mistaken it would be :
This will match an & NOT followed by ‘amp;’