Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > I want to exclude an expression of a sequence of charecters with regex

Reply
Thread Tools

I want to exclude an expression of a sequence of charecters with regex

 
 
28tommy
Guest
Posts: n/a
 
      12-27-2005
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 (-:

 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      12-27-2005
"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>



 
Reply With Quote
 
 
 
 
28tommy
Guest
Posts: n/a
 
      12-28-2005
Thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove junk charecters Index C++ 4 10-06-2006 01:55 AM
Garbage Charecters Vishal Dalsania ASP .Net 0 07-27-2006 02:59 PM
I want to read all charecters of pdf file ... Alex Smith ASP .Net 1 06-17-2005 01:25 PM
What charecters the lightweight component have? Bruce Sam Java 1 12-17-2004 08:22 AM
performing action on set of charecters jeff Python 2 01-23-2004 07:46 AM



Advertisments