regular expressions problem
Hi all,
I want replace all occurances of " dot " by .<br />
I used this code
$clean_db_text = str_replace(".", ".<br />", $clean_db_text);
But , it caused problems , when it find www.domain.com , It replaces them.I don't need that . I only want any other dot to be replaced.
I tried :
$pattern = "[^www]\.[^com]";
$replace = ".<br />";
$clean_db_text = preg_replace($pattern, $replace, $clean_db_text);
But I got the following error :
Warning: preg_replace(): Unknown modifier '\' in D:\xampp\htdocs\alaa\test_regex.php on line 16
Can someone help ?
I just wanted to say by regular expressions , any . not preceeded by "www" and not followed by "com" or "net"
PHP Code:
$pattern = '/(?<!www)\.(?!com)/i'
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in
Nation
eBookworm.us
Nice ! worked..
Thank you .
But that worked only for .com , How can I make it working for .com and .net .org ?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in
Nation
eBookworm.us
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks