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 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.