Reputation: 2166
I need to create a regex that will meet the following criteria:
Valid characters: 0-9 and hyphen (-) only. Entry must be between 11 and 13 characters. Also, must not contain the string "73480"
Upvotes: -2
Views: 107
Reputation: 93636
You want two regexes for clarity.
First check that this matches:
/^[-\d]{11,13}$/
and then check for failing to match:
/73480/
In Perl you'd do this like /^[-\d]{11,13}$/ && !/73480/
. If this was PHP, you'd make two calls to preg_match
.
Trying to cram it all into one regex makes things too hard to read in the future.
Upvotes: 0