[SOLVED] how is regular expression causing error?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
voltrader
Forum Contributor
Posts: 223
Joined: Wed Jul 07, 2004 12:44 pm
Location: SF Bay Area

how is regular expression causing error?

Post by voltrader »

I'm in process of validating photo file type suffixes using js.

The regex I dug up is:
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*.*))+\.(jpg|JPG|png|PNG|gif|GIF)$

It doesn't work when I test for it using:

Code: Select all

var regex = ^((їa-zA-Z]:)|(\\{2}\w+)\$?)(\\(\wї\w ]*.*))+\.(jpg|JPG|png|PNG|gif|GIF)$;

if(photo.value !='' && !regex.test(photo.value))
{
alert ("we only support .jpg, .png, .gif");
return false;
}
I located the error: it's in the regex. If I comment it out, the script executes.

Could it be the squigglies?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

var regex = /blahblbhalbah/;
User avatar
voltrader
Forum Contributor
Posts: 223
Joined: Wed Jul 07, 2004 12:44 pm
Location: SF Bay Area

[SOLVED]

Post by voltrader »

Thanks (yet again)
Post Reply