newmrd has asked for the wisdom of the Perl Monks concerning the following question:
hello. can anybody help me converting code below from perl to java:
sub validate_and_fix_regex { my $regex = $_[0]; eval { qr/$regex/ }; if ($@) { $regex = rquote($regex); } return $regex; } sub rquote { my $string = $_[0] || return; $string =~ s/([^A-Za-z_0-9 "'\\])/\\$1/g; return $string; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: From Perl to Java
by GrandFather (Saint) on Jun 28, 2015 at 06:26 UTC | |
|
Re^2: From Perl to Java
by Anonymous Monk on Jun 28, 2015 at 13:12 UTC |