note 101259 added to function.preg-match-all

From: Date: Mon, 06 Dec 2010 10:03:08 +0000
Subject: note 101259 added to function.preg-match-all
Groups: php.notes 
Request: Send a blank email to php-notes+get-174639@lists.php.net to get a copy of this message
if you want to extract all {token}s from a string: <?php $pattern = "/{[^}]*}/"; $subject = "{token1} foo {token2} bar"; preg_match_all($pattern, $subject, $matches); print_r($matches); ?> output: Array ( [0] => Array ( [0] => {token1} [1] => {token2} ) ) ---- Server IP: 212.124.37.9 Probable Submitter: 95.88.16.87 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match-all.php Edit -- https://master.php.net/note/edit/101259 Del: integrated -- https://master.php.net/note/delete/101259/integrated Del: useless -- https://master.php.net/note/delete/101259/useless Del: bad code -- https://master.php.net/note/delete/101259/bad+code Del: spam -- https://master.php.net/note/delete/101259/spam Del: non-english -- https://master.php.net/note/delete/101259/non-english Del: in docs -- https://master.php.net/note/delete/101259/in+docs Del: other reasons-- https://master.php.net/note/delete/101259 Reject -- https://master.php.net/note/reject/101259 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174639) next »