Reputation: 113
if only one & I could use
value = value.Replace("&","&")
but as per checking the data, some has "&amp" and many more.
Why is it decoded with multiple amp when original text is only one "&"?
I'm not a regex expert, I'd like to seek help to just create a regex that would decode it to only one ampersand.
Many thanks for those who will help :) Thanks
Upvotes: 1
Views: 2692
Reputation: 217
In JavaScript, as long as it is a String, you can use:
value = value.replaceAll("&", "&");
This is strictly for the exact string "& amp ;" though.
Upvotes: 0
Reputation: 152216
You can try to search for:
&(amp;)+
so:
value = value.Replace("&(amp;)+","&")
Upvotes: 1