Flow Designer Replace String transform - how does it support case insensitive modifier in a regex?

Tony Flitton
Tera Contributor

Hi there

Does the Replace String transform in Flow Designer support the case insensitive modifier /i in a regex?  We've tried a valid regex as follows:

^\*External: /gi

We want to remove occurrences of *External: from a field regardless of case but adding the /gi modifiers causing the transform to do nothing.  Removing the modifiers it works fine but of course won't work on strings with a different case. E.g.  EXTERNAL or external etc.

Is it just not supported or is there another way to encode this in the regex?  The documentation only has a limited plain string example. and honestly who would remove pepperoni from pizza anyway.
 

 

screenshot attached

2 REPLIES 2

Tony Flitton
Tera Contributor

Hi Folks

Through some trial and error I've managed to get this working by using the Java inline flag special construct mentioned here:

https://docs.servicenow.com/bundle/paris-application-development/page/script/general-scripting/concept/c_RegularExpressionsInScripts.html

So ^\*External: /i 

becomes 

(?i)^\*External:

This then matches *External: , *external: ,  *EXTERNAL: ,  *ExTERnal:   etc etc.

Thanks

Hi,

A kind of late response, but I was searching for community posts on using regex with transform functions in Flow designer, and I stumbled upon your question... anyhow..

Another way of doing this, would be to chain several transforms together, first use the toLowerCase transform function, and then skip the case insensitive regex part of the regex, and just use Contains.