Re: Help with REGEXP please

From: Date: Fri, 04 Mar 2005 20:12:52 +0000
Subject: Re: Help with REGEXP please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210035@lists.php.net to get a copy of this message
Hello Shaun, Friday, March 4, 2005, 12:54:34 PM, you wrote: S> Please could someone tell me how i can extract the information from S> a string that is after 'ID_' and before '_FN' <?php $myString = "ID_723456ABc_FN"; preg_match("/ID_([a-z0-9]+)_FN/i",$myString, $extracted); echo $extracted[1]; ?> This will match any upper or lowercase letter and number. If you have other characters like _ , etc, then you'll need to put those in the [a-z0-9_,] too. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

« previous php.general (#210035) next »