Scraping after certain words

Mikey1234

Banned
May 6, 2012
1,441
0
0
UK
With re.compile or re.search is there anyway to find what you are looking for after a certain word in the HTML


Or stop after certain word or length
 

Bstrdsmkr

New member
Mar 16, 2012
763
0
0
You need to include what you want to look after as part of the regex. For example if you have:

blah blah target foo bar target alpha bravo charlie blah blah target

and you want to capture everything between the second and third occurrence of target, your regex might look something like:

"target .*? target (.*?)target"

so match.group(1) = "alpha bravo charlie blah blah "