Use / instead of pipe as regexp fence in order to make pipe work inside the regexp. Needs testing

namespaces
Svein-Tore Griff With 2013-11-25 23:44:45 +01:00
parent 69ad6c9370
commit 563a5f2674
1 changed files with 1 additions and 1 deletions

View File

@ -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