tags:

views:

82

answers:

3

Hi I have a string like below

url('/testProject/Images/Current/Universal/Styles/MasterPage_HomeIcon.gif') repeat-x

How can I extract the substring starting from ' to end ' ? I am using language as C#

A: 

Like this? (Assuming PCRE)

/(\'.*\')/
artemb
+1  A: 

If you want to check the surrounding text:

/url\(('[^']+')\)/

If the surrounding text does not matter:

/('[^']+')/

The [^'] selects all characters except the closing quote.

rsp
A: 

If you do not want ' to be part of the matched group:

/'([^']*)'/
Amarghosh