Posted By

iblis on 08/28/07


Tagged

regex


Versions (?)

Test for (in)valid regex


 / Published in: Perl
 

  1. # Test for (in)valid regex
  2. # perl regex
  3. #
  4. # (you may need to disable warnings)
  5.  
  6. my $pattern = shift;
  7. my $regex = eval { qr/$pattern/ };
  8. die "Your regex doesn't seem valid : $@" if $@;

Report this snippet  

You need to login to post a comment.