note 115614 deleted from function.preg-match by cmb
| From: | cmb@php.net | Date: | Sun, 13 Oct 2019 07:56:08 +0000 |
| Subject: | note 115614 deleted from function.preg-match by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212620@lists.php.net to get a copy of this message | ||
Note Submitter: dkr at dotnull dot de
----
I noted that PCRE_ANCHORED (the pattern modifier A) does work fine if using an offset. If you use
the escape sequence \A or even the dash "^" in the regex, it does not work (even if in
multiline mode)...
<?php
$text = 'foo bar';
print (int) preg_match('/^bar/',$text,$a,null,4); // prints 0
print (int) preg_match('/\Abar/',$text,$a,null,4); // prints 0
print (int) preg_match('/bar/A',$text,$a,null,4); // prints 1
?>
Hope this helps someone out there! :-)
Version: PHP 5.5.12