regex - Perl pattern matching and use of \k -
regex - Perl pattern matching and use of \k -
i facing bit difficulty in using \k
in regular expressions in perl. next lines need info after pipemed_tb
array , skip part before can help that. if possible please tell how utilize \k
in next lines.
set stimulustop pipemed_tb.pipemed1.gtmc1.gthevcpar91.vncunit1 set stimulustop pipemed_tb.pipemed1.gtmc1.gthevcpar91.vneunit1 set stimulustop vprunit_tb.vprunit1
you must confusing \k<n>
back-reference , perl \k
preceding match omitting operator. not need here.
here sample programme (part of redundant illustrative purposes):
my @vals = (); push(@vals, "set stimulustop pipemed_tb.pipemed1.gtmc1.gthevcpar91.vncunit1"); push(@vals, "set stimulustop pipemed_tb.pipemed1.gtmc1.gthevcpar91.vneunit1"); push(@vals, "set stimulustop vprunit_tb.vprunit1"); foreach $i (@vals) { $i =~ s/set stimulustop //g; print $i."\n"; }
output:
pipemed_tb.pipemed1.gtmc1.gthevcpar91.vncunit1 pipemed_tb.pipemed1.gtmc1.gthevcpar91.vneunit1 vprunit_tb.vprunit1
regex perl
Comments
Post a Comment