The CreatorCon Call for Content is officially open! Get started here.

Need a regex to allow all characters and spaces, but no lower case letters. Valid length is 0 - 60.

Joe Taylor
Giga Guru

Need a regex to allow all characters and spaces, but no lower case letters. Valid length is 0 - 60 characters.

 

I want to use this in a multiline variable called "item_short_description".

 

Thanks.

11 REPLIES 11

Harish KM
Kilo Patron
Kilo Patron

Hi @Joe Taylor The below regex works for me

^[a-z\s]{0,60}$

^start with string.

[^a-z\s] matches any character that is not a lowercase letter along with space

{0,60} range from 0 to 60 characters including space.

 

HarishKM_0-1710810785056.png

 

Regards
Harish

This not correct.  I ONLY want capital letters, NO Lowercase.

Also, I want all other characters allowed including spaces.

Finally, how do I implement on a multi-line variable?

Hi @Joe Taylor then use below regex for capital letters

^[A-Z\s]{0,60}$

The above regex will.allow only with uppercase all characters with spaces  

You can add this regex under variable validation regex module and call this regex in your variable under Type specification

Follow  steps as mentioned here

https://www.servicenow.com/community/developer-articles/field-validation-regular-expressions/ta-p/23...

 

Regards
Harish

This is still not correct.

 

I want ALL characters, EXCEPT lowercase.

 

Also, you can't apply regex to Multi-line variables like this.