You can put your separators in there as literals to keep them out of
captures:
$ cat /tmp/ver.pl
#!perl
while () {
if ( /([\w+-]{3,})-([.\d-]+)\./ ) {
print "$1 - $2\n";
}
print "$_\n";
}
__END__
binutils-2.23.52.0.1-12.el7.x86_64
compat-libcap1-1.10-3.el7.x86_64
Hello,
You can begin with "*[a-zA-Z_+-]{3,}[0-9]*" to get the package name, it
needs a little more work for right now it gets the last dash and first
digit of package version. Then you can try "*([^a-zA-Z_+-]{3,})(.\d{1,})*".
The first regex gives the following result:
/binutils-2//