Tom743 0 Report post Posted May 28, 2008 If i have a word like c.........a......t (with the dots in) and i wanted to replace it with cat how would i do it. If i use <?php$patterns = "/c(*)a(*)t/";$replace = "cat";echo preg_replace($patterns, $replace, 'c.....a.........t');[/color][color="#000000"]?> then when i type something like "come and look at this" is also filtered. Is there any way just to filter cat with dots in? Share this post Link to post Share on other sites
truefusion 3 Report post Posted May 29, 2008 If all you want to do is eliminate dots found specifically inbetween the letters "c", "a" and "t", then the following should work: $patterns = "/c\.{2,}a\.{2,}t/";$replace = "cat";echo preg_replace($patterns, $replace, 'c.....a.........t');Anything else would require a more complex pattern. Share this post Link to post Share on other sites