in reply to Re^2: regex needed
in thread regex needed
I modified it a bit to include the space if it exists:
my $var = 'Sensor30'; while (<DATA>) { chomp; if (/^(>\s*)?\Q$var\E$/) { print "MATCH => $_\n"; } } __DATA__ >Sensor30 >FooSensor30 > Sensor30 Sensor300 Sensor30 >Sensor3
|
---|