Quote:
Originally Posted by mgraphic
Using the + will capture one or more in the number set, so it will capture 9 or 99 or 999999. The replace string will replace the $1 with the captured value.
|
well in my code it appears to only work with 1, @post-4 get's linked, @post-47 does not. EDIT: or something else must be wrong... now nothing works, it worked only on one entry, even if i had the same text on others, and then I deleted it and now none work... this is weird.
PHP Code:
<?php
$text = preg_replace('/^@post-([0-9]+)$/', '<a href="#post-$1">@post-$1</a>', "@post-4 @post-0 @post-22 @post-2 @post-12 @post-2 @post-21");
echo $text;
?>
doesn't work
Last edited by Skeddles; 02-05-2011 at 02:39 PM..
|