Re: Regex function needed

From: Date: Fri, 08 Feb 2002 16:13:57 +0000
Subject: Re: Regex function needed
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-84005@lists.php.net to get a copy of this message
Bas Jobsen wrote:
Op donderdag 07 februari 2002 23:58, schreef Michael Kimsal:
Looking for a regex (preg or ereg) to remove all 1, 2 and 3 character words.
<? $string="over deze regex loop ik nu al de hele dag en een uur te piekeren. 't wil niet! of wel! l'a."; $string=" ".$string; while (preg_match("/\W\w{1,3}\W/i",$string)) $string = preg_replace("/\W\w{1,3}\W/i", " ", $string); $string=substr($string,1); echo $string; ?>
This looks like it should do the trick - thank you. And thanks to everyone else who replied as well!

« previous php.general (#84005) next »