note 68544 added to reference.pcre.pattern.syntax
| From: | Nox at Oreigon dot de | Date: | Tue, 01 Aug 2006 15:13:41 +0000 |
| Subject: | note 68544 added to reference.pcre.pattern.syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115413@lists.php.net to get a copy of this message | ||
The following expression will find all correctly escaped parentheses. Here with '{' and
'}'. You will simply have to change all occurences to change the behavior for other
parentheses.
<?
$string = 'this is a{test with \\{ and \\}}.';
$reg =
'/(?:(?<!\\\\\\){((?:(?:(?<=\\\\\\)[{}]|[^{}])'
. '|(?R))+)(?<!\\\\\\)})/ms'
preg_match($reg, $string, $return);
?>
I hope this will help someone.
If there are any mistakes, plz write me
Thx
Nox
----
Server IP: 217.160.72.57
Probable Submitter: 62.206.21.246
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
Edit -- https://master.php.net/note/edit/68544
Del: integrated -- https://master.php.net/note/delete/68544/integrated
Del: useless -- https://master.php.net/note/delete/68544/useless
Del: bad code -- https://master.php.net/note/delete/68544/bad+code
Del: spam -- https://master.php.net/note/delete/68544/spam
Del: non-english -- https://master.php.net/note/delete/68544/non-english
Del: in docs -- https://master.php.net/note/delete/68544/in+docs
Del: other reasons-- https://master.php.net/note/delete/68544
Reject -- https://master.php.net/note/reject/68544
Search -- https://master.php.net/manage/user-notes.php