regular expression - matching a string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yoni@nobhillsoft.com

    regular expression - matching a string

    Hey
    I need the regexp pattern to match a single quoted string. its a bit
    tricky since double single quotes in the middle are part of the
    string, and we should continue to capture till the next single quote.
    an example:

    'this is ''all'' one string!'

    get it? who can help me?
    thanks!

  • Christof Nordiek

    #2
    Re: regular expression - matching a string

    <yoni@nobhillso ft.comschrieb im Newsbeitrag
    news:1192548490 .892827.193660@ e34g2000pro.goo glegroups.com.. .
    Hey
    I need the regexp pattern to match a single quoted string. its a bit
    tricky since double single quotes in the middle are part of the
    string, and we should continue to capture till the next single quote.
    an example:
    >
    'this is ''all'' one string!'
    >
    get it? who can help me?
    thanks!
    >
    Does this work?
    '([^']|'')*'

    Christof

    Comment

    • Rad [Visual C# MVP]

      #3
      Re: regular expression - matching a string

      On Tue, 16 Oct 2007 15:28:10 -0000, yoni@nobhillsof t.com wrote:
      >Hey
      >I need the regexp pattern to match a single quoted string. its a bit
      >tricky since double single quotes in the middle are part of the
      >string, and we should continue to capture till the next single quote.
      >an example:
      >
      >'this is ''all'' one string!'
      >
      >get it? who can help me?
      >thanks!
      Try this

      '(.*)'

      --

      Comment

      Working...