Working in C#/.NET
I'm trying to do string replacement. Our previous string replacement matched %anything%. Due to issues with having 2 % in the same string I'm trying to allow users to enter a % as %% and not have it identified for string replacement.
These should each find a single%foo% match:
"foo%foo%foo"
"%foo%foo"
"foo%foo%"
"%foo%"
These should have no matches:
"foo"
"%%"
"%%foo"
"foo%%"
"%%foo%%"
"foo%%foo%%foo"
"foo%%foo%%"
"%%foo%%foo"
"%foo%%"
"%foo%%foo"
"foo%foo%%"
"foo%foo%%foo"
"%%foo%"
"%%foo%foo"
"foo%%foo%"
"foo%%foo%foo"
Have tried variations on [^%]?%[^%]+%[^%] with no luck.
Thanks!