Regex for matching a quoted string with possible escape characters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adam Atlas

    Regex for matching a quoted string with possible escape characters

    I seek a regular expression, pcre or ereg (it doesn't matter), which,
    given a quoted string (e.g. "foo" => foo) will return the contained
    text, but that will accommodate escaped quote characters within the
    string (e.g. "foo\"bar" => foo"bar).

    Thanks.
    ] Adam

  • John Dunlop

    #2
    Re: Regex for matching a quoted string with possible escape characters

    Adam Atlas wrote:
    [color=blue]
    > I seek a regular expression, pcre or ereg (it doesn't matter), which,
    > given a quoted string (e.g. "foo" => foo) will return the contained
    > text, but that will accommodate escaped quote characters within the
    > string (e.g. "foo\"bar" => foo"bar).[/color]

    `"(.*?)(?<!\\\) "`

    --
    Jock

    Comment

    Working...