m{
^
mkdir
\s+
(-p\s+)?
\Q/net/some/where\E
$
}x
Quoting the path may not be necessary if it's a known constant.
On Mon, Apr 4, 2011 at 11:40 AM, Yaron Golan <[email protected]> wrote:
> Hi all,
> I am trying to have the following 2 options valid into 1 REGEX, but not
> sure that this is the best way to do it.
> Please share your options.
>
> I wish that the following 2 strings will be valid:
> mkdir /net/some/where
> mkdir -p /net/some/where
>
> So far, the best REGEX I managed to come up with is:
> ^mkdir ?-?p? /net/some/where$
>
> Is there a better way?
> I'd appreciate your answers ...
>
>
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>
--
Gaal Yahas <[email protected]>
http://gaal.livejournal.com/
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl