I'm trying to figure out the following regular expression:
/^[0-9]{2}-[0-9]{2,3}[a-zA-z]{0,1}/g
In my example.
The following should pass: 00-45, 00-333, 33-333a, 55-34a
The following should fail: 33-3333, 22-22dd, 22-2233
Here is my screenshot:
But the once that should fail arent failing. In my javascript code I just do a test:
var regExp = new RegExp(exp);
if(regExp.test(test1))
alert('pass');
else
alert('fail');
Is there a way for the regular expression to test the entire string? Example 33-3333 passes because of 33-333, but since there is another 3 I would like it to fail since the fourth 3 would be tested against the character rule?

^and$to indicate line beginning and endingnew RegExp(exp, 'g');?