Posted by Erwin Moller on 08/07/07 10:35
Ah, I learned something today. :-)
Here is one that works in 1 regex with lookbehind and ahead. :-)
<?php
$var='<category id="031" parent-id="1" level="2">\n<category id="233"
parent-id="1" level="3">\n<category id="31" parent-id="5" level="6">';
$expr = '/(?<=\sid=")\d+(?=")/';
preg_match_all($expr,$var,$results);
echo "<pre>";
print_r($results[0]);
echo "</pre>";
?>
Navigation:
[Reply to this message]
|