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
Something like this might also work as well:
if ( strstr($line, "CONFIRMED") ) {
// do the magic to parse text here.
}
-phpninja