View Single Post
Old 12-06-2007, 02:13 AM   #2 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

They're called named capturing groups (as opposed to just capturing groups or non-capturing groups). There are a few alternative syntaxes in RegEx-land for doing this, but (?P<name>...) is all that PHP can use (PCRE).

More information is available on the ever useful regular-expressions.info site or in the PHP Manual. As far as I'm aware, the numeric key cannot be omitted from the resulting array of matches. That said it's a trivial matter to parse that array to remove items with a numeric key if you really wanted to.
Salathe is offline  
Reply With Quote
The Following 2 Users Say Thank You to Salathe For This Useful Post:
Matt83 (12-06-2007), Wildhoney (12-06-2007)