Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bad-regex.pl 311B

123456789101112131415
  1. #!/usr/bin/env perl
  2. use warnings;
  3. use strict;
  4. use 5.10.0;
  5. my $intentionally_broken_regex = '[';
  6. my $compiled_regex;
  7. eval {
  8. $compiled_regex = qr/$intentionally_broken_regex/;
  9. };
  10. if ($@) {
  11. # There should be an error, so let's just quote everything:
  12. $compiled_regex = qr/\Q$intentionally_broken_regex\E/
  13. }