in reply to Dynamic Regular Expression
18> my @nodes = qw(K1 ASC GEB N1) $res[7] = [ 'K1', 'ASC', 'GEB', 'N1' ] + 19> my $regex = join '|', map { $_.'_(\w*\d*)'} @nodes $res[8] = 'K1_(\\w*\\d*)|ASC_(\\w*\\d*)|GEB_(\\w*\\d*)|N1_(\\w*\\d*)' + 20> map { s/^$regex$//r } qw/drivel K1_bar42 ASC_foo666 whatever/ $res[9] = [ 'drivel', '', '', 'whatever' ] + 21>
> I am new to Perl, ...
see perlintro
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dynamic Regular Expression
by Pratikh (Initiate) on Jan 06, 2021 at 15:57 UTC |