Charset Regular Expression
Posted on 2008-10-26
I made a crawler, and in each page I have to get the information of the charset.
I made in this way, but the regular expression not is the best, and somethimes I get the charset like: charset=UTF-8" /> or charset=iso-8859-1">, and I want just the word utf-8, iso-8859-1 or other.
My code is this one (regular expression):
preg_match("/charset ?.* \"/ix", $codigo, $charset);
Have a perfect regular expression for this?