You are here: Re: [PHP] Help with REGEXP please « PHP « IT news, forums, messages
Re: [PHP] Help with REGEXP please

Posted by Leif Gregory on 03/04/05 22:12

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация