"I want to extract the two right most digits after the minus sign."
There are different ways to understand what you said, and the example you given might just be one of the pattern you have.
For example, I could say this meets your requirement:
use strict; use warnings; my $str = "25364-564756ABCD"; $str =~ /-\d*?(\d{2}).*$/; print $1;
It would be a good idea to give more examples to cover more of your patterns, if you actuall have.
In reply to Re: Regex to extract digits
by pg
in thread Regex to extract digits
by gcazianfnf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |