Leon Kyriacou
Leon Kyriacou

Reputation: 402

Regex Python, Find Everything Inbetween Quotes after Keyword

I have strings that looks like this:

"Grand Theft Auto V (5)" border="0" src="/product_images/Gaming/Playstation4 Software/5026555416986_s.jpg" title="Grand... (the string continues for a while here)

I want to use regex to grab this: /product_images/Gaming/Playstation4 Software/5026555416986_s.jpg

Basically, everything in src="..."

At the moment I produce a list using re.findall(r'"([^"]*)"', line) and grab the appropriate one, but there's a lot of quotes in the full string and I'd like to be more efficient.

Can anyone help me put together an expression for this please?

Upvotes: 0

Views: 52

Answers (2)

vintol
vintol

Reputation: 48

Use this as RE :

src="(.+?)"

This will return result as you want.

re.findall('src="(.+?)"', text_to_search_from)

Upvotes: 1

leoinstack
leoinstack

Reputation: 26

Try with this

(?<=src=").+(?=" )

Upvotes: 1

Related Questions