Stationtype ?keyword?: check regex
This commit is contained in:
parent
813152b091
commit
cf21b6c1a0
1 changed files with 7 additions and 0 deletions
|
|
@ -157,9 +157,16 @@
|
||||||
*/
|
*/
|
||||||
private function isMatching($regex, $answer)
|
private function isMatching($regex, $answer)
|
||||||
{
|
{
|
||||||
|
// Check regex
|
||||||
|
if(empty($regex)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute regex
|
||||||
$score = preg_match($regex, trim($answer));
|
$score = preg_match($regex, trim($answer));
|
||||||
|
|
||||||
|
|
||||||
|
// Return result
|
||||||
return ($score !== false && $score > 0);
|
return ($score !== false && $score > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue