Question Help with Regex

chewdoggie

New member
Joined
Nov 11, 2013
Messages
1
Programming Experience
10+
Hello All,

I have some strings that look like this "%sometext%" (w/o quotes) and I need to reformat it as "$sometext". Currently, my solution is clunky. Lots of IndexOf tests, splitting strings, looping and whatnot.

I was thinking that there must be a better way to accomplish the same via a Regex.

Some examples of what the strings might look like:

a) "%sometext%" which should look like "$sometext"
b) "Some other text that %looks%\\%like% this" which should look like "Some other text that $looks\\$like this"
c) "Some other text that %looks%%like%%this%" which should look like "Some other text that $looks$like$this"

Any help from some Regex gurus would be appreciated.

Thanks !

Chew
 
Top Bottom