glenelkins Posted July 15, 2009 Share Posted July 15, 2009 Hi Is there a way to do a pettern match in jQuery? I have tried the following and doesnt work! var pattern = '/[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/'; var string = 'test@test.com'; if ( string.match ( pattern ) ) { //do something good } else { //do something bad } Quote Link to comment Share on other sites More sharing options...
trq Posted July 15, 2009 Share Posted July 15, 2009 You would use normal Javascript as you have done above. Quote Link to comment Share on other sites More sharing options...
glenelkins Posted July 15, 2009 Author Share Posted July 15, 2009 well what i have above doesnt work Quote Link to comment Share on other sites More sharing options...
glenelkins Posted July 15, 2009 Author Share Posted July 15, 2009 bump Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.