Regex Validation

Carina4
Tera Contributor

Hi! 

Can you help me with a Regex validation for string field, I need to prevent that the first character be: space, '-', '(', ')', ', '//', '\\' 

 

I need to prevent that the string CANNOT start with a SPECIAL CHARACTER or a BLANK space and ','strictly not allowed in any field.

"." "/"  These are allowed and upper letters ASCII and numbers.

1 ACCEPTED SOLUTION

Dipen Wadhwana
Giga Guru

Hi @Carina4 ,

 

Sure, here's a regular expression pattern that satisfies your requirements:

^([A-Z0-9./][A-Z0-9./]*)$

This pattern ensures that the string must start with an uppercase letter, number, . or /, and then can be followed by any combination of uppercase letters, numbers, ., or /. It disallows any string that starts with a special character or a blank space and strictly does not allow a comma. I hope this helps!

 

Please mark my solution as helpful if it worked for you.

View solution in original post

2 REPLIES 2

Priyanka0402
Mega Sage
Mega Sage

Hello @Carina4 ,

Try using this Regex ^[A-Za-z0-9./][A-Za-z0-9./]*$

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards

Priyanka

Dipen Wadhwana
Giga Guru

Hi @Carina4 ,

 

Sure, here's a regular expression pattern that satisfies your requirements:

^([A-Z0-9./][A-Z0-9./]*)$

This pattern ensures that the string must start with an uppercase letter, number, . or /, and then can be followed by any combination of uppercase letters, numbers, ., or /. It disallows any string that starts with a special character or a blank space and strictly does not allow a comma. I hope this helps!

 

Please mark my solution as helpful if it worked for you.