KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to write a function that receives a string and a regex. I need to check if there is a match and return the start and end location of a match. (The regex was already compiled by qr// .) The function might also receive a "global" flag and then I need to return the (start,end) pairs of all the matches. I cannot change the regex, not even add () around it as the user might use () and \1 . Maybe I can use (?:) . Example: given "ababab" and the regex qr/ab/ , in the global case I need to get back 3 pairs of (start, end).
Tags (comma-separated)
Save Edits
Cancel