From: mark-nielsen Date: Tue, 16 May 2006 03:06:28 +0000 (+0000) Subject: [Merged][BugFix] Bug 5485 - problem with regular expressions with simple analysis X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=74e3524216d72b905c567a5ac4b18b7f7a3cd753;p=moodle.git [Merged][BugFix] Bug 5485 - problem with regular expressions with simple analysis --- diff --git a/mod/lesson/action/continue.php b/mod/lesson/action/continue.php index 261de15984..cd7c3a1379 100644 --- a/mod/lesson/action/continue.php +++ b/mod/lesson/action/continue.php @@ -156,10 +156,10 @@ $expectedanswer = substr($expectedanswer,0,strlen($expectedanswer) - 2); $ignorecase = 'i'; } - } - // prevent the potential apostrophe problem! - if (preg_match_all("/'/",$expectedanswer, $matches)) { - $expectedanswer = ereg_replace("'", "\\\'", $expectedanswer); + } else { + $expectedanswer = str_replace('*', '#####', $expectedanswer); + $expectedanswer = preg_quote($expectedanswer, '/'); + $expectedanswer = str_replace('#####', '.*', $expectedanswer); } // see if user typed in any of the correct answers if (lesson_iscorrect($pageid, $answer->jumpto) or ($lesson->custom && $answer->score > 0) ) {