Questtype ?Textinput?: trim answers for regex matching
This commit is contained in:
parent
5f7a067e5e
commit
ae1c9a509b
1 changed files with 8 additions and 1 deletions
|
|
@ -172,9 +172,16 @@
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Check if an Character answer matches a Regex.
|
||||
*
|
||||
* @param string $regex Regex to match against
|
||||
* @param string $answer Character answer to match
|
||||
* @return boolean Whether answer matches Regex or not
|
||||
*/
|
||||
private function isMatching($regex, $answer)
|
||||
{
|
||||
$score = preg_match($regex, $answer);
|
||||
$score = preg_match($regex, trim($answer));
|
||||
|
||||
|
||||
return ($score !== false && $score > 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue