SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2008
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    regular expressions help

    Hi all,

    This is a part of my regular expression :
    PHP Code:
    (\".+\") 
    matching double quotes followed by anything then double quotes .

    I want to edit it so that it matches double quotes followed by anything ( But not single quotes) then double quotes .


    Can some help

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Location
    United Kingdom
    Posts
    78
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Your pattern is almost there, though instead of using the period to denote any character allowed, you should use a character class instead. You can use a caret (^) at the start of the character class to specify any characters you do not want to match (in this case, it is a single quote):
    Code:
    #(\"[^\']+\")#


Bookmarks

Posting Permissions

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