jquery says:
http://docs.jquery.com/JQuery_Core_Style_Guidelines#RegExp
All RegExp operations should be done
using .test() and .exec().
“string”.match() is no longer used.
Why is .match() not recommended?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A major benefit of
execis that it returns capturing groups. For example:match:
exec:
Reviewing the coding standards you’ve posted; the document contains many seemingly arbitrary guidelines. Obviously, it aims to achieve mostly consistency, so it is possible
execis preferred because it has more functionality – it has to be used on some occasions, so they might as well use it always.On a personal note, I don’t care much for guidelines without explanations, so it’s a good thing you’ve asked. In many cases it leads to dogmatic or superstition-based programming.