Re: Help with REGEXP please

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

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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