[thelist] PHP Regular Expression Dilemma

Marty Landman marty at face2interface.com
Tue Mar 6 10:07:40 CST 2001


At Tuesday 3/6/01 10:30 AM, you wrote:

>$Description =
>eregi_replace("<a[^<]*javascript:[^>]*>([^<]*)</a>","\\1",$Description);
>
>The problem is the ([^<]*) part - I need to make this say "any text until
>you reach the next "</a>" statement.

try ".*?" instead... also I'm more familiar with regex' in perl and wonder 
if you need the "s" option at the end to treat $Description as a single 
line, i.e. ignore newlines.

in perl I might say something more like

$Description =~ /<a[^<]*javascript:.*?>(.*)?</a>/si;

hth,

Marty
http://face2interface.com





More information about the thelist mailing list