Hello!
I'm trying to parse a string and extracting the word before based on group matches. Below is my code:
$str = "This is a string which has bi-weekly data"; if ($str =~ /(\w+)[- ](daily|month|days|weekly|week)/) { $found= $1; } print $found
This works well and returns "bi" which is what I found. However, I also want to know which of the terms matches. Is there a way I can print that as well? So, my final output should be: bi, weekly. or 12,month
Thanks a lot in advance
Regards,madbee
In reply to Group matching - Extracting what matches by madbee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |