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 = '[email protected]'; if ( string.match ( pattern ) ) { //do something good } else { //do something bad } Link to comment https://forums.phpfreaks.com/topic/166034-pattern-matching-jquery-regex/ 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. Link to comment https://forums.phpfreaks.com/topic/166034-pattern-matching-jquery-regex/#findComment-875649 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 Link to comment https://forums.phpfreaks.com/topic/166034-pattern-matching-jquery-regex/#findComment-875653 Share on other sites More sharing options...
glenelkins Posted July 15, 2009 Author Share Posted July 15, 2009 bump Link to comment https://forums.phpfreaks.com/topic/166034-pattern-matching-jquery-regex/#findComment-875739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.