in reply to Help combining two regex's into one
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help combining two regex's into one
by Anonymous Monk on Jan 15, 2013 at 06:49 UTC | |
by roboticus (Chancellor) on Jan 15, 2013 at 11:50 UTC | |
|
Re^2: Help combining two regex's into one
by AnomalousMonk (Archbishop) on Jan 16, 2013 at 01:07 UTC | |
by Kenosis (Priest) on Jan 16, 2013 at 02:45 UTC | |
by AnomalousMonk (Archbishop) on Jan 16, 2013 at 04:19 UTC | |
by Kenosis (Priest) on Jan 16, 2013 at 04:38 UTC | |
by LanX (Saint) on Jan 16, 2013 at 03:11 UTC |