0

I am running Sonar and checkstyle has a regexp rule like this:

^[a-z][a-zA-Z0-9]*$

I would like to modify it so that one or more underscores are allowed. How would I change this? Thanks!

user1340582
  • 19,151
  • 35
  • 115
  • 171

1 Answers1

2

Those are character classes.

If you want to allow underscores anywhere:

^[a-z_][a-zA-Z0-9_]*$

If you want to allow underscores anywhere except the first character:

^[a-z][a-zA-Z0-9_]*$
Mark Byers
  • 811,555
  • 193
  • 1,581
  • 1,452