Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74022
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'matches': 0.07; 'subject:Question': 0.07; 'string': 0.09; 'character,': 0.09; 'literal': 0.09; 'matched': 0.09; 'python': 0.11; 'times,': 0.14; 'useful,': 0.14; 'a),': 0.16; 'forth.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'once.': 0.16; 'quite.': 0.16; 'received:192.168.1.4': 0.16; 'subject:skip:m 10': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'pieces': 0.19; 'written': 0.21; 'header:User-Agent:1': 0.23; 'specifies': 0.24; 'question': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'character': 0.29; "doesn't": 0.30; 'characters': 0.30; 'mix': 0.30; 'usually': 0.31; 'decimal': 0.31; 'another': 0.32; 'but': 0.35; 'really': 0.36; 'useful': 0.36; 'hi,': 0.36; 'example,': 0.37; 'so,': 0.37; 'form,': 0.38; 'question,': 0.38; 'to:addr :python-list': 0.38; 'previous': 0.38; 'ability': 0.39; 'to:addr:python.org': 0.39; 'is.': 0.60; 'matter': 0.61; 'first': 0.61; 'more': 0.64; 'natural': 0.68; 'below:': 0.68; 'jul': 0.74; 'power': 0.76; 'regexp': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=OZcWD3jY c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=u9EReRu7m0cA:10 a=fYbsqdoXkfoA:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=pGLkceISAAAA:8 a=OmF7ZsBcGK4FcrKFmtgA:9 a=i--rt7_DizepKDtK:21 a=KlOaXdkdSnxYe2ne:21 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10 |
| X-AUTH | mrabarnett:2500 |
| Date | Sun, 06 Jul 2014 16:32:26 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Question about metacharacter '*' |
| References | <3f7ecf04-b881-4e79-aa59-893580090468@googlegroups.com> <CABicbJKUOsKW77LGkDF-1E52AmsPpTJq=GAUTA2PLpff+7fxNQ@mail.gmail.com> |
| In-Reply-To | <CABicbJKUOsKW77LGkDF-1E52AmsPpTJq=GAUTA2PLpff+7fxNQ@mail.gmail.com> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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.11543.1404660755.18130.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1404660755 news.xs4all.nl 2910 [2001:888:2000:d::a6]:46219 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:74022 |
Show key headers only | View raw
On 2014-07-06 13:09, Devin Jeanpierre wrote: > On Sun, Jul 6, 2014 at 4:51 AM, <rxjwg98@gmail.com> wrote: >> Hi, >> >> I just begin to learn Python. I do not see the usefulness of '*' in its >> description below: >> >> >> >> >> The first metacharacter for repeating things that we'll look at is *. * doesn't >> match the literal character *; instead, it specifies that the previous character >> can be matched zero or more times, instead of exactly once. >> >> For example, ca*t will match ct (0 a characters), cat (1 a), caaat (3 a >> characters), and so forth. >> >> >> >> It has to be used with other search constraints? > > (BTW, this is a regexp question, not really a Python question per se.) > > That's usually when it's useful, yeah. For example, [0-9] matches any > of the characters 0 through 9. So to match a natural number written in > decimal form, we might use the regexp [0-9][0-9]*, which matches the > strings "1", "12", and "007", but not "" or "Jeffrey". > > Another useful one is `.*` -- `.` matches exactly one character, no > matter what that character is. So, `.*` matches any string at all. > Not quite. It won't match a '\n' unless the DOTALL flag is turned on. > The power of regexps stems from the ability to mix and match all of > the regexp pieces in pretty much any way you want. >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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