speed up using $offset parameter with strpos()/preg_match()

 * reduce using substr()
 * preg_match() with $offset parameter.
 * preg_match() with 'A' regex modifier.