Reply to Re: [PHP] Regex nightmares

Your name:

Reply:


Posted by John Nichel on 05/23/05 20:20

W Luke wrote:
> Hi,
>
> I really struggle with regex, and would appreciate some guidance.
> Basically, I have a whole load of files (HTML) which are updated every
> few minutes. I need to go through each line, looking for the word
> CONFIRMED: (which is always in capitals, and always superseded by a
> colon). The line looks like this:
>
> 22.5 J.Smith at Thropton, CONFIRMED: more text here, including commas
> and info on the appointment etc
>
> There are other similar appointments that haven't yet been confirmed,
> so..I just need to pick out the confirmed ones. Once the regex finds
> "CONFIRMED:" I also need it to grab the text up to and including the
> date (22.5). I don't really need any text *after* "CONFIRMED:" yet,
> but possible in the future.
>
> There seem to be a lot of tutorials on, eg, getting hrefs from anchor
> tags, but I can't get my head around this particular one. Any ideas
> or pointers would be great

preg_match ( "/\d{1,2}\.\d{1,2}(.*)CONFIRMED:/", $text, $result );

Any matches will be in the array $result starting at $result[1].

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com

[Back to original 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

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