Use Pat Match to Replace Multiple Instances of a Pattern?Hi. Suppose I have a string containing multiple instances of the same pattern. I can use Pat Match to replace the first instance, but is there a pattern expression I could use to replace all instances?
Example:
sample = "baazaaaa";
x = "a" | "b";
rc = Pat Match(sample, x, "c");
Show(sample); //Returns "caazaaaa", but I want "ccczcccc"
The Substitute or Munger commands would work, but I'm specifically looking to see if Pat Match can do the same.
Re: Use Pat Match to Replace Multiple Instances of a Pattern?You can of course use the return code to comntrol iteration within a while loop
sample = "baazaaaa";
x = "a" | "b";
success = 1;
While(success,
success=Pat Match(sample, x, "c")
);
show(sample)
But I'm guessing you would like to do it all with an appropriate pattern definition.