From 563a5f267440c5fb90836e37809a23f3dec3df15 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Mon, 25 Nov 2013 23:44:45 +0100 Subject: [PATCH] Use / instead of pipe as regexp fence in order to make pipe work inside the regexp. Needs testing --- h5p.classes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/h5p.classes.php b/h5p.classes.php index 373db37..ebd0e02 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1439,7 +1439,7 @@ class H5PContentValidator { if (isset($semantics->regexp)) { // Note: '|' used as regexp fence, to allow / in actual patterns. // But also escaping '|' found in patterns, so that is valid too. - $pattern = '|' . str_replace('|', '\\|', $semantics->regexp->pattern) . '|'; + $pattern = '/' . str_replace('/', '\/', $semantics->regexp->pattern) . '/'; $pattern .= isset($semantics->regexp->modifiers) ? $semantics->regexp->modifiers : ''; if (preg_match($pattern, $text) === 0) { // Note: explicitly ignore return value FALSE, to avoid removing text