|
|
|
|
![]() ![]() |
May 28 2008, 01:19 PM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 7 Joined: 12-January 08 Member No.: 56,132 |
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
CODE <?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? |
|
|
|
May 29 2008, 03:10 AM
Post
#2
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,893 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 ![]() |
If all you want to do is eliminate dots found specifically inbetween the letters "c", "a" and "t", then the following should work:
CODE $patterns = "/c\.{2,}a\.{2,}t/"; $replace = "cat"; echo preg_replace($patterns, $replace, 'c.....a.........t'); Anything else would require a more complex pattern. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th September 2008 - 01:35 PM |