in reply to Checking user input on dynamic regular expressions

You could always use the qr// operator to compile the regex and check the success of the compilation using eval.

my $pat = <STDIN>; # random nonsense from a user my $re = eval { qr/$pat/ }; die "Nasty regex!: $@\n" if $@;
--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me