brianlange Posted April 29, 2010 Share Posted April 29, 2010 The regular expression in jQuery to test for for HTML strings and ID strings is /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/ What I don't understand is why the return value for regExp.exec('#test') returns #test,,test I don't understand why it returns an empty string for the second result? When I only use the second half of the expression /^#([\w-]+)$/ the return value is '#test','test' and when I only use the first half of the expression /^[^<]*(<[\w\W]+>)[^>]*$/ the return value is null. Can someone explain this? Thanks, Brian Link to comment https://forums.phpfreaks.com/topic/200177-jquery-regular-expression/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.