Re: A little regex help

From: Date: Fri, 13 Dec 2002 19:11:20 +0000
Subject: Re: A little regex help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128190@lists.php.net to get a copy of this message
> I'm trying to work out the regex needed to split either one of the > following lines > > Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information > Windows XP Hotfix (SP2) See Q327696 for more information > > Into one of these > > Windows 2000 Hotfix (Pre-SP4) See <a > > href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'>Q > 322842</a> for more information > Windows XP Hotfix (SP2) See <a > > href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696>Q3 > 27696</a> for more information $new_string = preg_replace("/Q[0-9]{6}/","urlgoeshere/default.aspx?scid=kb;en-us;$1",$old_ string); I didn't put the actual URL because OE mangles it and turns it into a link. Hopefully that helps. You can use Q|q or /Q[0-9]{6}/i to make it case insensitive, too, if you want. ---John Holmes...

« previous php.general (#128190) next »