Page 1 of 1

Finding text three characters before chosen string

Posted: Mon Dec 29, 2008 4:48 pm
by grgwhl
Hi, Seasons greetings etc. everybody, I hope you had a good one! I need some help please ! I have a html file in a var called $html which I have got using CURL.

In this file there is a tag called <beforethis>. And just before this tag is a number (it could be 1 digit or 2).

How would I go about searching through $html and finding the number just before the <beforethis> tag?

I'd be REALLY greatful if anybody could help, I've tried to explain clearly but if I haven't I'll be willing to elaborate.

Many Thanks

Re: Finding text three characters before chosen string

Posted: Mon Dec 29, 2008 6:20 pm
by requinix
Which PHP are you running? Is it really HTML, or is it XML?