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


Groups > comp.lang.python > #74135

Re: Question about metacharacter '*'

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jeanpierreda@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; '(of': 0.07; 'patterns.': 0.07; 'subject:Question': 0.07; "'')": 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'subject:skip:m 10': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'example': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'header :In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'linux': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'two': 0.37; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'jul': 0.74; '2014,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=SDone+6h8mTwK0ePFJ3ygo08V53h9L0xSn6AWs7qq7M=; b=bQmUiT7KwwqKcS1O+ZGKP03Ym0D9MfpHmxs3AOLyXGFkLt6OWVx1xGUWZCQGNsE7ZX InH1cuPBIJFk9y+ubAE/V4LwW8CPa3Acwvlj34vylWUcCnASF/xLnwpZVzA738QJnsWY I4nIF5xFRGqXQlwJ90NcU2rYK8iGaSMJfO0UFGVxv1aJAR+KbKDw5J5aMUxipCvDvHYd 3KhOpjNPRBbJTb0l44eOAPTLMCU5nxFMPfUbP+1Nv2EZBOVevTYUICMhnli1TAIahHnQ AjB2U+h18nALLE0b6RSynGHGfXfV/sdISvyiuVOsrnvnOlh2WmAtLkRCc9yZkdSzbFM/ UdhQ==
X-Received by 10.229.53.133 with SMTP id m5mr35093112qcg.19.1404764919444; Mon, 07 Jul 2014 13:28:39 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <86b50887-96b0-4a21-8b0a-26c5a435c76d@googlegroups.com>
References <3f7ecf04-b881-4e79-aa59-893580090468@googlegroups.com> <mailman.11536.1404648646.18130.python-list@python.org> <86b50887-96b0-4a21-8b0a-26c5a435c76d@googlegroups.com>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date Mon, 7 Jul 2014 13:27:59 -0700
Subject Re: Question about metacharacter '*'
To Robert Willy <rxjwg98@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc "comp.lang.python" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11609.1404764921.18130.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1404764921 news.xs4all.nl 2861 [2001:888:2000:d::a6]:51662
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74135

Show key headers only | View raw


On Mon, Jul 7, 2014 at 11:51 AM,  <rxjwg98@gmail.com> wrote:
> Would you give me an example using your pattern: `.*` -- `.`?
> I try it, but it cannot pass. (of course, I use it incorrectly)

Those are two patterns.

Python 3.4.1 (default, Jul  7 2014, 13:22:02)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.fullmatch(r'.', 'a')
<_sre.SRE_Match object; span=(0, 1), match='a'>
>>> re.fullmatch(r'.', 'ab')
>>> re.fullmatch(r'.', '')
>>>
>>> re.fullmatch(r'.*', 'a')
<_sre.SRE_Match object; span=(0, 1), match='a'>
>>> re.fullmatch(r'.*', 'ab')
<_sre.SRE_Match object; span=(0, 2), match='ab'>
>>> re.fullmatch(r'.*', '')
<_sre.SRE_Match object; span=(0, 0), match=''>

-- Devin

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