tags:

views:

31

answers:

1

Really simple situation:

Eg. in this string:

my dog said "woof" today

I would like to get the string in quotes, but without the quotes...

--- more detail ---

Unfortunately the regex is via 3rd party software so I don't know the underlying engine.

Here's the string:

href="http://pagingdrgupta.blogs.cnn.com/2010/08/17/dengue-fever-increases-in-florida/?hpt=T2">Dengue outbreak 

Current regex:

(https?://)?([-\w]+(\.\w[-\w]*)+|([a-z0-9]([-a-z0-9]*[a-z0-9])?\.))+(com|edu|biz|gov|in(t|fo)|mil|net|org|[a-z][a-z]\.[a-z][a-z])\S*)

this returns:

http:.../?hpt=T2">Dengue

Adding " to start and end of regex works, but includes the ".

Perhaps there's another way?

A: 

This is going to depend on the "flavour" of regex that you are using. If your regex engine supports lookarounds (positive lookbehind, positive lookahead, negative lookbehind, and negative lookahead), you can do this.

The syntax also varies by flavour, so if you edit your question and/or tags to show what language you're working in, you can get a more specific answer.

Jay
Unforunately the regex is via 3rd party software so I don't know the underlying engine. |Here's the string:href="http://pagingdrgupta.blogs.cnn.com/2010/08/17/dengue-fever-increases-in-florida/?hpt=T2">Dengue outbreak|Current regex:(https?://)?([-\w]+(\.\w[-\w]*)+|([a-z0-9]([-a-z0-9]*[a-z0-9])?\.))+(com|edu|biz|gov|in(t|fo)|mil|net|org|[a-z][a-z]\.[a-z][a-z])\S*)|this returns:http:.../?hpt=T2">Dengue|Adding " to start and end of regex works, but includes the ". | Perhaps there's another way?
Kieryn
@Kieryn add that to your question
BioBuckyBall
Does your regex software not support capture groups? If you're string only has one href in it perhaps something like `href="([^"]+)"` would work (the url should be captured).
cam