What's the best way to write this regular expression?

Roy Smith roy at panix.com
Tue Mar 6 20:26:11 EST 2012


In article 
<12783654.1174.1331073814011.JavaMail.geo-discussion-forums at yner4>,
 John Salerno <johnjsal at gmail.com> wrote:

> I sort of have to work with what the website gives me (as you'll see below), 
> but today I encountered an exception to my RE. Let me just give all the 
> specific information first. The point of my script is to go to the specified 
> URL and extract song information from it.

Rule #1: Don't try to parse XML, HTML, or any other kind of ML with 
regular expressions.

Rule #2: Use a dedicated ML parser.  I like lxml (http://lxml.de/).  
There's other possibilities.

Rule #3: If in doubt, see rule #1.



More information about the Python-list mailing list