CJ Weber
CJ Weber

Reputation: 41

Looking for a regex that only grabs up to the second " quote mark not any further

I need a regex that grabs only up to the second quotation mark and nothing further.

img src=\"/uploadedImages/2012_December_OTW_Ocean Wave bottle.jpg\" alt=\"2010_JAN_OTW_Oceanbottle.jpg\"

I only need

img src=\"/uploadedImages/2012_December_OTW_Ocean Wave bottle.jpg\"

can anyone help me figure out a regex for this I have been struggling.

Upvotes: 0

Views: 21

Answers (2)

Kasravnd
Kasravnd

Reputation: 107347

Try the following regex :

^[^"]*"[^"]*"

Demo

Upvotes: 1

Sam
Sam

Reputation: 20486

Use a negative character class:

"([^"]*)"

Demo.

Upvotes: 0

Related Questions