Re: [PHP] preg_replace anything that isn't WORD

2009-08-24 Thread tedd
On Sat, Aug 22, 2009 at 12:32 PM, “•ÈýÏݓ•ÂÔdanondan...@gmail.com wrote: Lets assume I have the string cats i saw a cat and a dog i want to strip everything except cat and dog so the result will be catcatdog, using preg_replace. I've tried something like /[^(dog|cat)]+/ but no success

Re: [PHP] preg_replace anything that isn't WORD

2009-08-24 Thread hack988 hack988
Use preg_replace_callback instead! preg_replace_callback is better performance than preg_replace with /e. - code $str=cats i saw a cat and a dog; $str1=preg_replace_callback(/(dog|cat|.)/is,call_replace,$str); echo

Re: [PHP] preg_replace anything that isn't WORD

2009-08-24 Thread Shawn McKenzie
hack988 hack988 wrote: Use preg_replace_callback instead! preg_replace_callback is better performance than preg_replace with /e. - code $str=cats i saw a cat and a dog;

Re: [PHP] preg_replace anything that isn't WORD

2009-08-24 Thread Jonathan Tapicer
For the record Shawn: I received your previous post from Aug 22 and I think that it is the best solution. Jonathan On Tue, Aug 25, 2009 at 12:41 AM, Shawn McKenzienos...@mckenzies.net wrote: hack988 hack988 wrote:  Use preg_replace_callback instead! preg_replace_callback is better performance

[PHP] preg_replace anything that isn't WORD

2009-08-22 Thread דניאל דנון
Lets assume I have the string cats i saw a cat and a dog i want to strip everything except cat and dog so the result will be catcatdog, using preg_replace. I've tried something like /[^(dog|cat)]+/ but no success What should I do? -- Use ROT26 for best security