Re: Regex nightmares

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

 



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@xxxxxxxxxxxx

--
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