You can also wrap it in an eval block and match an empty string to it.
my $regex = <>;
eval {
'' =~ /$regex/;
}
die "Bad Regex!" if( $@ );
-----Original Message-----
From: Karthik Krishnamurthy
To: [EMAIL PROTECTED]
Sent: 9/4/2001 7:46 AM
Subject: Re: Validate the regex
regex itself. use regular expressions to check for validity
/kk
On Tue, Sep 04, 2001 at 05:26:05PM -0400, neeraj arora wrote:
> Hey
> i am writing a piece of code that reads a regex and matches it with a
> file name.
> Is there anything using which i can validate that the regex i input is
> valid or not.
> eg *.gif is not a valid regex so i want to discard that
> thanks in advance
> neeraj
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]