<?php $regex = 'test.'; // match print preg_match('/^'.$regex.'$/i', 'tests') ? 'match' : 'nomatch'; print PHP_EOL; // nomatch print preg_match('/^'.preg_quote($regex).'$/i', 'tests') ? 'match' : 'nomatch'; print PHP_EOL; // nomatch print preg_match('/^\Q'.$regex.'\E$/i', 'tests') ? 'match' : 'nomatch'; print PHP_EOL; ?>
You have javascript disabled. You will not be able to edit any code.