that is wrong because it includes "-" and "p" alone

try (-p)?
or noncapturing parens if you care
-- vish



On 4 April 2011 09:40, 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
>
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to