CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: Valid Regular expression: Edit Log



mhx
Enthusiast

Jun 29, 2001, 7:54 AM


Views: 12137
Re: Valid Regular expression

Hi,

say your regex is stored in $re, then you can test if it's valid with

Code
eval { '' =~ /$re/ }; 
unless( $@ ) {
print "Regex is valid!\n";
}
else {
print "Regex is invalid!$@";
}

Hope this is what you were looking for.

-- Marcus

(This post was edited by mhx on Jun 29, 2001, 6:59 AM)


This post has not been edited


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives