- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
I am trying to have LC validate three different patterns in a text field. One would be one letter followed by 6 numbers, two is 6 numbers, and three is 9 numbers. This is what I have so far. It's close, but not quite doing what I need. It is correctly validating one, but with the two and three it is allowing anything between 6 and 9 numbers, not just 6 or 9 numbers. Suggestions?
var
r = new RegExp();
r.compile("^[a-zA-Z]+[0-9]{6}|[0-9]{6}|[0-9]{9}$"
,"i");
var
result = r.test(this.rawValue);
if
(result == true)
true;
else
false;
Solved! Go to Solution.
Views
Replies
0 Likes
Total Likes