Mathias Rechtzigel
Mathias Rechtzigel

Reputation: 3604

Regex - Special Character After 1 or more digits

I'm fairly rough with regex and I need to have a special character after number. If there is multiple numbers then the special character would have to be after the entire group.

Special Characters include !@#$%^&*()

abcd1 not valid

abcd1# valid

abcd11# valid

What I currently have checks if the string is between 5 and 30 characters and contains a number

^(?=.*\d)(?=.*[a-zA-Z]).{5,30}$

Upvotes: 1

Views: 146

Answers (1)

Dave Sexton
Dave Sexton

Reputation: 11188

Try this:

'\d+[!@#$%^&*()]'

Upvotes: 1

Related Questions