Hello. I need to find and replace substring with dot in it. It's important to keep search strict to word boundaries (\b). Here's an example script to reproduce (i need to match "test."):
<?php
# 1.php
$string = 'test. lorem ipsum';
if(!preg_match('~\btest\.\b~i', $string)) echo 'no match 1' . PHP_EOL;
if(!preg_match('~\btest\b\.~i', $string)) echo 'no match 2' . PHP_EOL;
And here's output:
x:\>php 1.php
no match 1
x:\>php -v
PHP 5.2.8 (cli) (built: Dec 8 2008 19:31:23)
Copyright (c) 1997-2008 The PHP Group
BTW, I also don't get any match if there're square brackets in search pattern. I do escape them of course, but still no effect.