Re: regular expressions

From: Date: Thu, 14 Apr 2005 13:14:21 +0000
Subject: Re: regular expressions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-213074@lists.php.net to get a copy of this message
The pattern $pattern = 'font\-size:.*?\;'; throwns the error eregi_replace(): REG_BADRPT Erwin Kerk wrote:
pete M wrote:
I've been messing about with this for a while to no avail.. so help would be appreciates I'm new to regular expressions and tried this with preg_replace, now I'm using eregi_replace ! here's the text $txt = '<span style="font-size: 10pt; font-family: "Times New Roman";">It<br /> blahh blahhh blahhh of<br /> </span>'; what I want to do it take the font-size and font-family attributes "out" so style="font-size: 10pt; font-family: "Times New Roman";" beomes style=" " and the php $pattern = 'font-size:*\;'; $txt = eregi_replace($replace,'',$txt); $pattern = 'font-family:*\;'; $txt = eregi_replace($replace,'',$txt); What I'm trying to do is match the font-size: and replace everything up to the ; with '' ie nothing dont work Feel I'm so close ;-( tia Pete
Try this: $pattern = 'font\-size:.*?\;'; Erwin Kerk


« previous php.general (#213074) next »