Re: Help with preg_match_all()
| From: | Klaus Reimer | Date: | Mon, 01 Nov 2004 10:16:06 +0000 |
| Subject: | Re: Help with preg_match_all() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-200821@lists.php.net to get a copy of this message | ||
Curt Zirzow wrote:
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
If you are already using the "?" meta character then you can simply do this: /{(.*?)}/ The "while not"-approch is useful if you don't want to use the "?" meta character (to be compatible to regex engines which don't support this). But then it would look like this: /{([^}]*)}/ But all these expressions are to lazy for the required work. The tags should be matched more exactly using this: /{$([\w\.]+)}/ This implies that the variable names always begin with a dollar character and they can contain upper and lowercase characters, numbers, underscores and periods. The variable name must contain at least one character, so {$} is not matched. -- Bye, K <http://www.ailis.de/~k/> (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger k@ailis.de to get public key)And so on.. It's a kind of a template system... well... I need to create a expression to get all the tags from the HTML with preg_match_all() in order to have them in a array...So your looking from something that starts with '{' and continues while not a ')' ... /{([^}]*?)}/
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc