Regex expression for a String

Hi All,

Need help in generating Regex expression for the below string.

I want to use a regular expression in an if condition to check if the current string is matching that syntax or not.
String is in form of Service Now ChangeRequest Number eg → CHG1234567, CHG3247586, CHG5768479 etc. Also, it should be not case sensitive.
the digits post CHG can be n number of digits like 8,9,10 etc. Example - CHG12345678, CHG123456789 etc

Any help is appreciated.


pattern could look like this:

for this we are using the CaseInsensitive regex option

Hi @Dhruvi_Arumugam check this regex pattern: (?:chg\d{1,7})

Hi @ppr

Thanks for the quick reply

In the expression you provided I can see you have use d{7} but if the digits increase than 7 will in that case it will work?

The expression should ideally check for this format starting with “CHG” and then having any n number of digits that makes a valid change request.


we can use for this CHG\d+\b
Kindly note:

How can we use this in If condition?

Thanks @Tapan_Behera1

The number of digits post CHG is not fixed



HI @Dhruvi_Arumugam

You can Try with this Regex Expression in If activity



@Dhruvi_Arumugam Okay then just update it to (?:chg\d*)

if you want to match at least one number or more then in that case you can change (*) to (+)

Check out the screenshot @Dhruvi_Arumugam


to complete the series:

as * means 0 or unlimited it will also match CHG without numbers


Thanks a lot @ppr @Gokul001 @Tapan_Behera1 for your valuable responses !

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.