Wondering if there is a way to capture only the part of a string matched by regex? If I have the following string:
$string_to_search="This part of the string is what I'm looking for and + I want to capture it. I want to capture all instances of this paart +of the string. Paaaaart of the string!";
How can I capture all strings within that string that match the pattern /pa+rt/i? So what I want for my return is:
@results = ('part','paart','Paaaaart');
In reply to Capturing string matched by regex by tunafish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |