i have a code but i cannot figure out why it gives me an error of:
Warning: preg_match(): Unknown modifier '<'
and this is the snippet
$pattern = "/<tr.*?data-eventid=\"(\d+)\"/" . // id
"<td.*?>\s{0,}.*\s(.*?)<div.*/?>\s(.*?)<\/td>\s{0,}" . // Day and Date
"<td.*?>(.*?)<\/td>\s{0,}" . // Time
"<td.*?>(.*?)<\/td>\s{0,}" . // Currency
"<td.*?>\s{0,}<div.*?>(.*?)<\/div>\s{0,}<\/td>\s{0,}" . // Impact
"<td.*?>\s{0,}<div.*?>(.*?)<\/div>\s{0,}<\/td>\s{0,}" . // Indicator
"<td.*?>\s{0,}<div.*?>(.*?)<\/div>\s{0,}<\/td>\s{0,}" . // Detail
"<td.*?>\s{0,}(.*?)\s{0,}<\/td>\s{0,}" . // Actual
"<td.*?>(.*?)<\/td>\s{0,}" . // Forecast
"<td.*?>(.*?)<\/td>\s{0,}". // Previous
"<td.*?>\s{0,}<div.*?>(.*?)<\/div>\s{0,}<\/td>\s{0,}/ims"; // Chart 忽略
i am so confused where to look for that < symbol..
Best Regards
First off, seriously, wow. That’s not a regular expression I’d throw at my worst enemy.
Those need to be escaped because they’re used as the delimiter. Not escaping them will make
pregthink the expression is over and trailing characters will be treated as modifiers.You should really look into a proper HTML parser though, this is madness!
See also:
DOMDocument