Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74063
| References | <1404668474.56075.BPMail_high_noncarrier@web163802.mail.gq1.yahoo.com> <53B9D273.1060706@mrabarnett.plus.com> |
|---|---|
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
| Date | 2014-07-06 17:39 -0700 |
| Subject | Re: Question about metacharacter '*' |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11565.1404693646.18130.python-list@python.org> (permalink) |
The reason I did not use \d\d* or \d+ or ^\d+$ or any number of more-correct things was because the OP was new to regexps. -- Devin On Sun, Jul 6, 2014 at 3:49 PM, MRAB <python@mrabarnett.plus.com> wrote: > On 2014-07-06 18:41, Albert-Jan Roskam wrote: >> >> >> >> >>> In article <d8f8d76d-0a47-4f59-8f09-da2a44cc1d2e@googlegroups.com>, >>> Rick Johnson <rantingrickjohnson@gmail.com> wrote: >>> >>>> As an aside i prefer to only utilize a "character set" when >>>> nothing else will suffice. And in this case r"[0-9][0-9]*" >>>> can be expressed just as correctly (and less noisy IMHO) as >>>> r"\d\d*". >>> >>> >>> Even better, r"\d+" >> >> >> I tend tot do that too, even though technically the two are not perfectly >> equivalent. With the re.LOCALE flag LC_ctype is also affected, which affects >> what is captured by \d but not by [0-9] >> > \d also matches more than just [0-9] in Unicode. > > -- > https://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Question about metacharacter '*' Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-07-06 17:39 -0700
csiph-web