in reply to Re^3: Using regex to separate parameters
in thread Using regex to separate parameters
sub find_parameters { my $input = $_[0]; if($input =~ /^(.+?\.\w{3})$/){ print "only one executable: $input\n"; }elsif($input =~ /^(.+?\.\w{3})( +)([\/\-].+)$/ && -f $1 ){ print "$1 with parameters $3\n"; }elsif($input =~ /^“(.+)”$/){ # strip quotes and parse again find_parameters($1); }else{ print "not parsed: $input\n"; }; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Using regex to separate parameters
by ikegami (Patriarch) on Jul 06, 2008 at 19:03 UTC | |
by resistance (Beadle) on Jul 06, 2008 at 19:29 UTC | |
by jethro (Monsignor) on Jul 06, 2008 at 23:14 UTC |