ada has asked for the wisdom of the Perl Monks concerning the following question:
/usr/bin/perl /usr/bin/ /perl / perl
if ($string =~ m#(\S*/)(\S*)#) { print "Path = $1, $Filename = $2\n"; } elsif ($string =~ /(\S+)/) { print "No path, Filename = $1\n"; }
Ok thanks everyone and for ur examples;
so in my example where the inbetween: (\S*)(\S*), does this cause the regex to jump down to the next line as there is just whitepace after the first capture/match?
x
Edit: g0n - code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: path extraction
by ikegami (Patriarch) on Dec 09, 2007 at 21:04 UTC | |
|
Re: path extraction
by GrandFather (Saint) on Dec 09, 2007 at 20:41 UTC | |
|
Re: path extraction
by mwah (Hermit) on Dec 09, 2007 at 20:31 UTC |