Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Regular Expression newbie needs help
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Fredrik Lundh  
View profile  
 More options May 29 1998, 3:00 am
Newsgroups: comp.lang.python
From: "Fredrik Lundh" <fred...@pythonware.com>
Date: 1998/05/29
Subject: Re: Regular Expression newbie needs help

>Another way to handle this case is to use the `[.]' regular
>expression, but to only look at strings which *don't* match it.  In
>other words:

>   if not re.search('[.]', string):
>       print '%s contains no periods' % (string)

How about:

    if "." not in string:
        print string, "contains no periods"

Cheers /F
fred...@pythonware.com
http://www.pythonware.com

    "Some people, when confronted with a problem, think 'I know, I'll use
    regular expressions.'  Now they have two problems."
        -- Jamie Zawinski, on comp.lang.emacs


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.