re.compile syntax help
#1
Hi Guys,

I'm having a little trouble with the re.compile command.

The problem I have is where the data is spread over multiple lines, like:-

Code:
<a href="/Videourl"><img alt="2" src="Thumbnailurl" /></a>
  </div>
  </div>
</div>
  <p><a href="videourl" title="VideoTitle"><strong>VideoTitle</strong></a><br />

I've seen some people use

Code:
match = re.compile(
             '1st bit' +
             '2nd bit'
             ).findall (html)

but I cant get that to produce a match. I also tried the triple speech marks, at the beginning and end, but still not working.

Anyone have any pointers?
Reply
#2
It would be helpful if you explain what exactly you are trying to match in the above HTML.

Also, look into passing the re.DOTALL flag to re.compile() if you are using a wildcard character to match newlines.
Reply
#3
Thanks jbel

In the above example I would be trying to match videourl, or videotitle. etc.

Will look anything re.DOTALL

thanks,
Reply

Logout Mark Read Team Forum Stats Members Help
re.compile syntax help0