From ae0b833ce811311277e01660b2a48c2a811b54e0 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 31 Aug 2018 08:43:11 +0200 Subject: TUWF::Validate::Interop: Don't escape @ in html5_validation() patterns --- lib/TUWF/Validate/Interop.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/TUWF/Validate/Interop.pm') diff --git a/lib/TUWF/Validate/Interop.pm b/lib/TUWF/Validate/Interop.pm index de4444e..25feb44 100644 --- a/lib/TUWF/Validate/Interop.pm +++ b/lib/TUWF/Validate/Interop.pm @@ -108,11 +108,15 @@ sub json_type { # Attempts to convert a stringified Perl regex into something that is compatible with JS. +# - @ should not be escaped # - (?^: is a perl alias for (?d-imnsx: # - Javascript doesn't officially support embedded modifiers in the first place, so these are removed # Regexes compiled with any of /imsx will not work properly. sub _re_compat { - $_[0] =~ s{\(\?\^?[alupimnsx]*(?:-[imnsx]+)?(?=[:\)])}{(?}gr; + local $_ = $_[0]; + s/\\@/@/g; + s{\(\?\^?[alupimnsx]*(?:-[imnsx]+)?(?=[:\)])}{(?}g; + $_ } -- cgit v1.2.3