regular expressions problem
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"
$pattern = '/(?<!www)\.(?!com)/i'
Nice ! worked..
Thank you .
But that worked only for .com , How can I make it working for .com and .net .org ?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)