Perhaps the following will be helpful:
use strict; use warnings; my $input = '-L/usr/local/lib -lmylib -lz'; $input =~ s!^-L(.+)\s+\K-l(.+)(?=\s+.+)!$1/$2.a!; print $input;
Output:
-L/usr/local/lib /usr/local/lib/mylib.a -lz
The \K says to keep all to its left. Here's an explanation of the regex.
In reply to Re: Help combining two regex's into one
by Kenosis
in thread Help combining two regex's into one
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |