FAQ
Hello all,

I know how to exclude 1 charecter from a compiled sequence of the re
module- '[^a]', but if I want to exclude a word or a sequence as one
unit (not as separate charecters) to be checked.... how do I do that?

I tried re.compile('[^(abc)]')
... or re.compile('[^a][^b][^c]')
... or re.compile('[^a^b^c]')
None of these worked.

Thanks in advance (-:

Search Discussions

  • Fredrik Lundh at Dec 27, 2005 at 3:42 pm

    "28tommy" wrote:

    I know how to exclude 1 charecter from a compiled sequence of the re
    module- '[^a]', but if I want to exclude a word or a sequence as one
    unit (not as separate charecters) to be checked.... how do I do that?

    I tried re.compile('[^(abc)]')
    ... or re.compile('[^a][^b][^c]')
    ... or re.compile('[^a^b^c]')
    None of these worked.
    look for "negative lookahead assertion" on this page:

    http://docs.python.org/lib/re-syntax.html

    </F>
  • 28tommy at Dec 28, 2005 at 12:45 pm
    Thanks.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedDec 27, '05 at 12:47p
activeDec 28, '05 at 12:45p
posts3
users2
websitepython.org

2 users in discussion

28tommy: 2 posts Fredrik Lundh: 1 post

People

Translate

site design / logo © 2022 Grokbase