summaryrefslogtreecommitdiff
path: root/lib/TUWF
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2018-08-31 08:43:11 +0200
committerYorhel <git@yorhel.nl>2018-08-31 08:43:11 +0200
commitae0b833ce811311277e01660b2a48c2a811b54e0 (patch)
tree5a31488d213aadf11f81bcd03b467770d6dab7f3 /lib/TUWF
parentd505653430b08686aadd77adfb5f62138f99275d (diff)
TUWF::Validate::Interop: Don't escape @ in html5_validation() patterns
Diffstat (limited to 'lib/TUWF')
-rw-r--r--lib/TUWF/Validate/Interop.pm6
1 files changed, 5 insertions, 1 deletions
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;
+ $_
}