cspctec has asked for the wisdom of the Perl Monks concerning the following question:
And I'm trying to create a regex to match "/home/example/testdir" and NOT any part of "sss40s1u01:/home/example/test.txt". I'm having some trouble coming up with a regex for this. So far, I have tried negative lookbehind:my @data = ('scp', 'sss40s1u01:/home/example/test.txt', '/home/example +/testdir');
But that matches "sss40s1u01:/home/example/test.txt" also.foreach (@data) { my $match = $_ if /(?<!:)\/.+/; }
I would appreciate any help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with a small regex
by hippo (Archbishop) on Feb 06, 2015 at 18:09 UTC | |
|
Re: Help with a small regex
by kennethk (Abbot) on Feb 06, 2015 at 18:14 UTC | |
|
Re: Help with a small regex
by cspctec (Sexton) on Feb 06, 2015 at 21:02 UTC | |
by AnomalousMonk (Archbishop) on Feb 06, 2015 at 22:11 UTC |