Preg_match - Find URL and convert to lower case

From: Date: Thu, 30 Nov 2006 22:16:16 +0000
Subject: Preg_match - Find URL and convert to lower case
Groups: php.general 
Request: Send a blank email to php-general+get-245379@lists.php.net to get a copy of this message
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

« previous php.general (#245379) next »