I have a regular expression like \r?\n\r?\n. I can write it as (\r?\n){2} using the exact same number of characters.
Is there any difference performance wise between the two? Or a best practices for this kind of situation.
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.
Here is a JSPerf to show that using a repeating pattern is a lot faster than using
{2}: http://jsperf.com/js-repeated-regexp-or-specific-number-of-sequences