New Regex Expression Option

jmiskey
Kilo Sage

I imagine this will probably be easy for anyone versed in Regex.  I just know very little about it.

 

I am trying to create a new entry in the "Question Regular Expressions" table, so I can use it in my Catalog Variable validation (in the "Validation Regex" field).  What I need to do is to limit the entries to only allow:

- lower case letters

- underscores

They can be in any order (no pattern) and can be any length.

 

I found a few old community articles and documents on Regex, and thought I could do it myself, but it is not working.

Here is the expression I tried:

^[a-z]*_$

However, it seems to be rejecting basic entries that I test like "a_b".

 

How do I need to write this expression?

 

Thanks

1 ACCEPTED SOLUTION

DrewW
Mega Sage
Mega Sage

You need to have the _ inbetween the [].  So this

^[a-z_]*

 

And you can use 

https://regex101.com/

 

to test it.

View solution in original post

2 REPLIES 2

DrewW
Mega Sage
Mega Sage

You need to have the _ inbetween the [].  So this

^[a-z_]*

 

And you can use 

https://regex101.com/

 

to test it.

Awesome!  It works!

 

Thank you very much!