Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

negative lookahead with same character

  •  11-15-2009, 9:53 AM

    negative lookahead with same character

    Hi,

    apologies in advance, if an example of this regex has been requested, I could not find it :(

    I am looking to match strings with an apostrophe, that is not following by another apostrophe.  That is I want to match the strings:

    'test

    test' 

    'test '' test

    but I do not want to match  the following

    test

    test''

    I tried the negative lookahead:   '(?!')     but this is matching the second apostrophe in the pairs.  How can I group the previous match to ignore the second char?

    Thanks!

     

    Filed under: ,
View Complete Thread