in reply to regex extraction for variable number of args
The following gives the output you want with the provided example:
#!/usr/bin/env perl use 5.010; use strict; use warnings; my $cmd = '&COMPAREEQUAL(First-param.one, Second.param,Third-param)'; my $cms_re = qr{ (?: [&( ] )? ( [^(), ]+ ) (?: [(,)] )? }x; say for $cmd =~ m{$cms_re}g;
Output:
$ pm_cmd_args_regex.pl COMPAREEQUAL First-param.one Second.param Third-param
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex extraction for variable number of args
by NetWallah (Canon) on Jul 21, 2012 at 14:13 UTC | |
by Corion (Patriarch) on Jul 21, 2012 at 14:24 UTC | |
by NetWallah (Canon) on Jul 21, 2012 at 14:46 UTC | |
by Corion (Patriarch) on Jul 22, 2012 at 07:15 UTC |