Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74032

Re: Question about metacharacter '*'

Newsgroups comp.lang.python
Date 2014-07-06 09:32 -0700
References <3f7ecf04-b881-4e79-aa59-893580090468@googlegroups.com> <CABicbJKUOsKW77LGkDF-1E52AmsPpTJq=GAUTA2PLpff+7fxNQ@mail.gmail.com> <53B96C0A.3030302@mrabarnett.plus.com> <mailman.11545.1404662273.18130.python-list@python.org> <d8f8d76d-0a47-4f59-8f09-da2a44cc1d2e@googlegroups.com>
Message-ID <c40ca02c-93e6-4a3c-86b5-bb4062421554@googlegroups.com> (permalink)
Subject Re: Question about metacharacter '*'
From Rick Johnson <rantingrickjohnson@gmail.com>

Show all headers | View raw


[CONTINUED FROM LAST REPLY...]

Likewise if your intent is to filter out any match strings
which contain non-digits, then define the start and stop
points of the pattern:

# Match only if all are digits
>>> re.match(r'\d\d*$', '111aaa222') # fails

# Match only if all are digits and,
# allow leading white-space
>>> re.match(r'\s*\d\d*$', '   111')
<_sre.SRE_Match object at 0x026D8410>
# But not trailing space!
>>> re.match(r'\s*\d\d*$', '   111 ') # fails

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Question about metacharacter '*' rxjwg98@gmail.com - 2014-07-06 04:51 -0700
  Re: Question about metacharacter '*' Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-07-06 05:09 -0700
    Re: Question about metacharacter '*' rxjwg98@gmail.com - 2014-07-07 11:51 -0700
      Re: Question about metacharacter '*' Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-07-07 13:27 -0700
      Re: Question about metacharacter '*' Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-07 22:50 +0100
  Re: Question about metacharacter '*' MRAB <python@mrabarnett.plus.com> - 2014-07-06 16:32 +0100
  Re: Question about metacharacter '*' Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-07-06 08:50 -0700
    Re: Question about metacharacter '*' Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-06 09:24 -0700
      Re: Question about metacharacter '*' Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-06 09:32 -0700
      Re: Question about metacharacter '*' Roy Smith <roy@panix.com> - 2014-07-06 12:47 -0400
        Re: Question about metacharacter '*' Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-06 10:38 -0700
          Re: Question about metacharacter '*' Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-06 10:58 -0700

csiph-web