Results 1 to 4 of 4

Thread: Regex check for quotes

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Regex check for quotes

    What regex pattern can be used to check to see if there is a string quote in a string?

    example,

    "bob said hi" //string 1

    and he said "hello" //string 2


    i want to make sure that string 1 or string 2 have quotes (opening and closing, together)

    thanks

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Regex check for quotes

    This?

    \".+\"

  3. #3
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    Re: Regex check for quotes

    Which'll match ["Hello" world"] - wouldn't a non-greedy match be more appropriate?

    \".+?\" (i.e. match ["Hello" world]

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Regex check for quotes

    I am not ashamed of my avarice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width