note 119691 added to regexp.reference.recursive
| From: | Anonymous | Date: | Thu, 04 Aug 2016 09:11:27 +0000 |
| Subject: | note 119691 added to regexp.reference.recursive | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206206@lists.php.net to get a copy of this message | ||
sass parse sample
<?php
$data = 'a { b { 1 } c { d { 2 } } }';
preg_match('/a (?<R>\{(?:[^{}]+|(?&R))*\})/', $data, $m);
preg_match('/b (?<R>\{(?:[^{}]+|(?&R))*\})/', $data, $m);
preg_match('/c (?<R>\{(?:[^{}]+|(?&R))*\})/', $data, $m);
preg_match('/d (?<R>\{(?:[^{}]+|(?&R))*\})/', $data, $m);
/*
Array (
[0] => a { b { 1 } c { d { 2 } } }
[R] => { b { 1 } c { d { 2 } } }
[1] => { b { 1 } c { d { 2 } } }
)
Array (
[0] => b { 1 }
[R] => { 1 }
[1] => { 1 }
)
Array (
[0] => c { d { 2 } }
[R] => { d { 2 } }
[1] => { d { 2 } }
)
Array (
[0] => d { 2 }
[R] => { 2 }
[1] => { 2 }
)
*/
----
Server IP: 72.52.91.14
Probable Submitter: 219.106.173.140
----
Manual Page -- http://php.net/manual/en/regexp.reference.recursive.php
Edit -- https://master.php.net/note/edit/119691
Del: integrated -- https://master.php.net/note/delete/119691/integrated
Del: useless -- https://master.php.net/note/delete/119691/useless
Del: bad code -- https://master.php.net/note/delete/119691/bad+code
Del: spam -- https://master.php.net/note/delete/119691/spam
Del: non-english -- https://master.php.net/note/delete/119691/non-english
Del: in docs -- https://master.php.net/note/delete/119691/in+docs
Del: other reasons-- https://master.php.net/note/delete/119691
Reject -- https://master.php.net/note/reject/119691
Search -- https://master.php.net/manage/user-notes.php