Flow Designer Replace String transform - how does it support case insensitive modifier in a regex?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 02:36 AM
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
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 12:55 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 06:13 AM
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.