I have to make a regular expression in PHP which captures a text that contains the string in which only uppercase letters, numbers, or Underscores are. Example: THIS_STUFF
, THIS_2_STUFF
, ONE_MORE_STUFF_2_CATCH
etc ... This works well with: / [A-Z0- 9_] /
However, I want to capture those sequences which are only:
- Minimum 5 characters ==> / [A-Z0- 9_] { 5,} /
- And with minimum 3 uppercase letters ==> ????
Do you have any ideas?
Thank you!
and with minimum 3 uppercase letters ==> ????
Use at the beginning of this.
^ (? = (?: [^ Az \ n] * [az]) {3}) [A-Z0- 9 _] {5,} $
< / Pre>OR
\ b (? = (?: [^ AZ] * [as]) {3}) [A-Z0-9_] {5,} + \ B
No comments:
Post a Comment