Shiplu wrote:
Sorry The previous code was wrong,
Its the correct version,

$x = "a b;c d;e f;";
preg_match('/(?P<keys>\w) (?P<values>\w)/',$x,$m);
print_r($m);

Now I am using backrefrence \1 in in ?P option like (?P<\1>\d+).

and I got the error.


thought I best update for courtesy sake; I spent a good chunk of time on this yesterday, read all the regex stuff I could find, and the closest I could get was to use recursive sub patterns, however there was no way to make a named subpattern name (<keys>) be a backreference / variable.. ie <$1> <\1> <\\1> will never work.

even using this method you're still going to have to combine the two arrays to get what you want ($m['keys'] with $m['values'])

Regards & do let me know if you manage!

Nathan

ps: there may be something in the ?>&name syntax; I don't think so though..

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to