Is there a way to retrieve regular expression object that contains the start position of the match, end position, total length etc.?
Or at least something like String.search(/pattern/), but with more than one result.
Thanks in advance!
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.
Exec is what you’re looking for I’d say.
Edit:
for example (and using the code from the linked page):
result.indexis the start positionre.lastIndexis the end positionresult[0].lengthis the total length