John wrote:
I need to match a pattern, not in a single-line but from a HTML page, which
obviously has loads of lines. I need to match 2 lines from this HTML page:
1) <HTML><TITLE>FirstVariable - Second Variable</TITLE></HTML>........
2) <TABLE><TD><TR>(newline)
ThirdVariable</TR></TD></TABLE>...

I tried this code:
1) preg_match("/<HTML><TITLE>(\S+) - (\S+)</TITLE></HTML>/", $html_page,
$variables);
2) preg_match("/<TABLE><TD><TR>\n(\S+)</TR></TD></TABLE>/", $html_page,
$variables);

The first 2 variables are matched into the $variables array but not the
third one. Sometimes when the third one is matched, it starts from where I
want it to start but takes all the text to the end of the HTML document!

Your "newline" may be \r\n or \r instead of just \n.


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to