View Single Post
Old 12-21-2009, 07:08 PM   #3 (permalink)
benton
The Contributor
 
Join Date: Apr 2008
Posts: 78
Thanks: 0
benton is on a distinguished road
Default

Thanks. Unfortunately, that was just a typo made while editing the post. The original code already had it in there. I did find that using quotes instead of apostrophes made a difference though. So this now works:
PHP Code:
preg_match("/<td align=\"right\" valign=\"top\"><h1>(.*)<\/h1><\/td>/i"$line$matches); 
I had to add more code in the check to get it to work.

So the next step is to read that in from the database so it works without manual edits. This is what I am trying to do (the top line is simulating what would be read from the database):
PHP Code:
$search_str '<td align="right" valign="top"><h1>(.*)</h1></td>';
$search_str str_replace("/""\\/"$search_str);
$search_str str_replace('"''\\"'$search_str);
$condition '"/'.$search_str '/i"';

preg_match($condition$line$matches); 
That doesn't create any erros and when I look at the source, the $condition appears exactly as when I type it in directly but the match isn't found. Does anyone have any suggestions on what might make this fail?
benton is offline  
Reply With Quote