[Nottingham] PHP RegEx woes

Charles Samuels charles at kde.org
Fri Oct 3 18:30:44 UTC 2008


Christopher Joice wrote, on Friday 2008 October 03:
> $page['content'] = ereg_replace("\[\[(.*)]]",
>                      '<a href="'.$site["url"].'/page/\\1">\\1</a>',
> $page['content']);

use preg_replace instead of ereg_replace. Then you can disable greediness the 
Perl way with '?' and the preg_ functions are *much* faster, too!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mailman.lug.org.uk/pipermail/nottingham/attachments/20081003/8c2d1ad1/attachment.pgp 


More information about the Nottingham mailing list