PDA

View Full Version : unexpecte quantifier in IE..WH->i'm using regex's..is that it..HELP??


BrightNail
06-29-2002, 02:16 AM
Hey all,

I have on a linux box and in Mozilla..my script is just fine..In IE..it bombs...I am gettting this error:

unexpected quantifier
Code=0

Here is my regex's....

var re = new RegExp ('_', 'gi');
var emailcheck=/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/
var verify=/^\d{10}/
var verifybday=/^\d{2}\-\d{2}\-\d{4}+$/
var verifyphones=/^\d{3}\-\d{3}\-\d{4}+$/

and here is how I test against them...

if((document.form.email)&&(!emailcheck.test(document.form.email.value))){
msg+="Valid Email\n";
Regpass=false;
}



there are a couple of IF statements..nothing complicated other than the regexs...but I am getting this error..anyone know why????

please advise.......kinda urgent

whammy
06-29-2002, 02:30 AM
Can you give the line number and the line(s) that the error is produced on?

Offhand I don't see anything wrong but I don't see re being used anywhere, and to be honest I've never used that kind of syntax so I'm not sure about that one.

:)

BrightNail
06-29-2002, 02:42 AM
hello,

actually,,,the code is very long....that was just a slice of it....I don't actually use that first REGEX...I will take this out..

var re = new RegExp ('_', 'gi');

line: 166
char: 37

I suspect it is one of these lines...as I've used that email regex before without a hitch...

var verifybday=/^\d{2}\-\d{2}\-\d{4}+$/
var verifyphones=/^\d{3}\-\d{3}\-\d{4}+$/

the "+" sign does seem off as I explicity say "4"...then i use the "+" sign...

hmm, let me take that out....any other thoughts..thanks

whammy
06-30-2002, 11:50 PM
Dave is right...

http://developer.netscape.com/docs/manuals/js/core/jsguide15/regexp.html#1010922

Check that out, it's a great reference for regular expressions. Go there and you'll see why what he said makes perfect sense. ;)


+

Matches the preceding character 1 or more times. Equivalent to {1,}.


For example, /a+/ matches the 'a' in "candy" and all the a's in "caaaaaaandy".