Regular Expression problem

From: Date: Fri, 10 Nov 2000 21:40:25 +0000
Subject: Regular Expression problem
Groups: php.general 
Request: Send a blank email to php-general+get-24722@lists.php.net to get a copy of this message
Hi, I'm stuck within a regex problem, I know you can match charachters until a character you DON'T want to match, something like: [^#]* matches all character until a # but what when you wanna list until a whole WORD? Here's my example: $bbcode=eregi_replace("(\[size=)([^]]*)(])([^[/size\]]*)(\[/size\])", "<font size=\\2>\\4</font>",$bbcode); This searches for [url=<LINK>]<HYPERLINK>[/url] and parses it to <a href="<LINK>"><HYPERLINK></a> the ([^]]*) part is to avoid greediness but now he doesn't parse things like: [url=<link>][i]<hyperlink>[/i][/url] which is logical because he has to quit when he meets a '[' What I want to do that he only stops when he finds: [/url], but [^[/url]] or [^\[/url\]] doesn't work.... Anyone understands what I mean and knows the answer? Thanks!

« previous php.general (#24722) next »