1

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#

2
  • 1
    What string below? It's missing from your question... Commented Oct 26, 2009 at 11:58
  • 1
    You should mention which language / regex library you'll be using. Commented Oct 26, 2009 at 12:00

3 Answers 3

1

If you want to check the surrounding text:

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

If the surrounding text does not matter:

/('[^']+')/

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

/'([^']*)'/

Comments

0

Like this? (Assuming PCRE)

/(\'.*\')/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.