RegEx Expression to Not Allow Certain Starting/Ending Characters

jmiskey
Kilo Sage

I admit, I know very little about RegEx.  Someone helped me build this RegEx expression, which limits entries to lower case letters, underscores, and periods.

^[a-z._]*

 

It works great.  However, they have another requirement.  No records can start or end with a period.

Is there anyway to update that RegEx expression to add that restriction?

 

Also, a bonus would be "nice to have, but not required", is there away to also not allow two or more periods in a row?

 

Thanks

1 ACCEPTED SOLUTION

Gangadhar Ravi
Giga Sage
Giga Sage

try ^[a-z]+(?:[._][a-z]+)*$

View solution in original post

2 REPLIES 2

Gangadhar Ravi
Giga Sage
Giga Sage

try ^[a-z]+(?:[._][a-z]+)*$

jmiskey
Kilo Sage

Awesome!  Initial testing seems to be working!

Thank you very much!