Difference Between The 2 Statements

Discussion in 'ASP .Net' started by RN1, Apr 13, 2008.

  1. RN1

    RN1 Guest

    Consider the following RegularExpression:

    ====================
    q[^u]
    ====================

    One of the RegEx tutorials I have come across says the following
    w.r.t. the above RegEx:

    ====================
    The above RegEx does not mean a 'q' not followed by a 'u'; rather it
    means a 'q' followed by a character that is not a 'u'.
    ====================

    Now what's the difference between the 2 statements that I have cited
    above?

    Thanks,

    Ron
     
    RN1, Apr 13, 2008
    #1
    1. Advertising

  2. Hello RN1,

    > Consider the following RegularExpression:
    >
    > ====================
    > q[^u]
    > ====================
    > One of the RegEx tutorials I have come across says the following
    > w.r.t. the above RegEx:
    >
    > ====================
    > The above RegEx does not mean a 'q' not followed by a 'u'; rather it
    > means a 'q' followed by a character that is not a 'u'.
    > ====================
    > Now what's the difference between the 2 statements that I have cited
    > above?
    >
    > Thanks,



    condider this input:

    q

    this could be read as a q not followed by a u.

    condider

    qd

    this could be read as a q not followed by a u.

    in regex this would be written as:

    q(?!u)

    The other regex however will never match the first option, because q[^u]
    alsways needs to match at least 2 characters, a q and a different character
    than u.


    --
    Jesse Houwing
    jesse.houwing at sogeti.nl
     
    Jesse Houwing, Apr 13, 2008
    #2
    1. Advertising

  3. RN1

    Peter Morris Guest

    q followed by anything as long as it is not q == match
    q followed by q == no match
     
    Peter Morris, Apr 13, 2008
    #3
  4. Also, q followed by nothing = no match



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en espaƱol : http://asp.net.do/foros/
    ======================================
    "Peter Morris" <mrpmorris at gmail dot com> wrote in message news:...
    >q followed by anything as long as it is not q == match
    > q followed by q == no match
     
    Juan T. Llibre, Apr 14, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil Zanella
    Replies:
    8
    Views:
    1,207
    mfmehdi
    Oct 20, 2006
  2. jakk
    Replies:
    4
    Views:
    12,393
  3. Harry George
    Replies:
    6
    Views:
    417
    Bart Nessux
    Feb 23, 2004
  4. ATSkyWalker
    Replies:
    11
    Views:
    570
    tiissa
    Apr 20, 2005
  5. deepak

    Difference between following statements

    deepak, Feb 25, 2013, in forum: C Programming
    Replies:
    25
    Views:
    684
    David Thompson
    Mar 11, 2013
Loading...

Share This Page