I’d like to use replace service with regular expression. Can someone help me create a regular expression for the following scenario.
inString = TEST1ZZTEST1A ZZTEST1B
searchString = ZZTEST1A ZZ
replaceString = ZZGOODTEST ZZ
result = TEST1ZZGOODTEST ZZTEST1B
Any help would be greatly appreciated.
If you need to replace text inside other text just use the pub.string:replace service. There’s no need to use regular expressions with it, simply feed in TEST1A as the search String parameter and GOODTEST as the replacement string…
Or is there something I’m missing?
Nath
I agree that the replace service will work with this example, but imagine that we are missing something with the example (it has to be more than just replacing test1a w/ goodtest).
If the strings appear as listed, it looks like ZZ could be used as a sperator of tokens, and you can use the pub.string:tokenize service. It will produce an output string list of all the values seperated by the ZZ string. You can then do as you wish with each of the tokens.
Or…the developers guide has a section for using regular expressions, but it gets confusing at times. If you google regex help there are numerous examples.
Or…provide some more detail and someone will post a solution.
This looks like a duplicate thread of one over on the webMethods Developer forum. Moving forward, please use that thread instead.
It can be found at:
http://advantage.webMethods.com/article/?id=1610625274
Thanks,
Nathen