Preg_match - Find URL and convert to lower case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have some text that comes out of a database all in uppercase (old IBM Mainframe that only supports uppercase characters).

Occasionally there are web addresses in this text and so I am trying to find them, convert them to a link, and convert them all to all lower case. Yes, I know that will not work for all links. However, it will work for about 90% of the links I have (vs. about 10% of them now).

So anyway, here is my first stab at this, but it only finds the link and converts the first part to lowercase and converts it to a link. Is there anyway to convert the output to all lowercase by doing something like this? Or is there a better way?

	$pattern = "/WWW.(.*?) /i";
	$replace = "<a href=\"http://www.\\1\";>http://www.\\1</a>";
	$section_notes = preg_replace($pattern,$replace,$section_notes);

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux