Reputation: 713
I have this regex that cause my validation message to fire because it requires 6 characters. I need a Regex that allows any amount of characters:
var unFieldRegEx = /^(?=.*[a-zA-Z\d])(\w|[\.\@\-\?\,\&\''\/\_\""]){6,}$/;
Upvotes: 1
Views: 189
Reputation: 26766
var unFieldRegEx = /^(?=.*[a-zA-Z\d])(\w|[\.\@\-\?\,\&\''\/\_\""])*$/;
should do it (remove the length specifier @ the end and replace with a *)
Upvotes: 1
Reputation: 32532
change {6,} to * for 0 or more characters. Change it to + for 1 or more characters.
Upvotes: 2