Re: regexp problem again

From: Date: Sat, 23 Dec 2000 22:51:28 +0000
Subject: Re: regexp problem again
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-31715@lists.php.net to get a copy of this message
Previously, Lars Wilhelmsen said: > curts: that didn't work: > > preg_replace("/>[\w*&\w*]*</a>/i","/[\w*&amp;\w*]*/",$YOUR_STRING); > > Any other suggestions? > ( substituting all &'s with &amp; if they're inside a > and </a> ? This appears to work, unless there are multiple &'s inside a single <A>: preg_replace("/(<a [^&]+>)([^&]*)&([^a])([^&]*)(\/a>)/i", "\\1\\2&amp;\\3\\4\\5", $string); -d -- Dan Lowe <dan@tangledhelix.com> http://tangledhelix.com/ If you try to fail, and succeed, which have you done? -George Carlin

« previous php.general (#31715) next »