This always works for me:
if (preg_match_all("!\"(.+)\"!sU", $var, $match))
{
for ($i=0; $i<count($match[0]); $i++)
{
$old = $match[1][$i];
$new = preg_replace("!\|| !", "_", $old);
$var = str_replace("\"$old\"", "\"$new\"", $var);
}
}
On Fri, Feb 02, 2007 at 07:30:37PM +0100, Sébastien WENSKE wrote:
> Hi all,
>
> I want replace the "|" (pipe) and the " " (space) chars where are between "
> (double-quotes) by an underscore "_" with the preg_replace(); funtction.
>
> Can someone help me to find the correct regex.
>
> Thanks in advance
>
> Seb
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php