How to validate length of a string and check if the substring are integers?

Justine Mae Ruf
Tera Expert

Hi,

 

I need this requirement in the condition wherein email subject of inbound email actions contains prefix+8digit number.

e.g. user should add this to subject line: CS00001234

 

It will pass the condition since it has the prefix (CS) + 8 digit number required. Action is that this will be populated to the custom field in a table.

 

 

1 REPLY 1

Ahmmed Ali
Mega Sage

Hello @Justine Mae Ruf 

 

You can use regular expression for the same.

 

var str = email.subject;

var regex = new SNC.Regex('/CS\\d{8}/im');

var csNumber = regex.match(str);

gs.info(csNumber);

 

Thank you,

Ali

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali