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


Groups > comp.lang.python > #64788

Re: re Questions

Date 2014-01-26 13:41 -0600
From Tim Chase <python.list@tim.thechases.com>
Subject Re: re Questions
References <3f568767-e13a-4c7d-a4fb-85caca2adf6e@googlegroups.com> <mailman.5996.1390756093.18130.python-list@python.org> <roy-B66F25.12151426012014@news.panix.com>
Newsgroups comp.lang.python
Message-ID <mailman.6000.1390765257.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 2014-01-26 12:15, Roy Smith wrote:
> > The set [A-z] is equivalent to
> > [ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz]  
> 
> I'm inclined to suggest the regex compiler should issue a warning
> for this.
> 
> I've never seen a character range other than A-Z, a-z, or 0-9.
> Well, I suppose A-F or a-f if you're trying to match hex digits
> (and some variations on that for octal).  But, I can't imagine any
> example where somebody wrote A-z and it wasn't an error.

I'd not object to warnings on that one literal "A-z" set, but I've
done some work with VINs¹ where the allowable character-set is A-Z and
digits, minus letters that can be hard to distinguish visually
(I/O/Q), so I've used ^[A-HJ-NPR-Z0-9]{17}$ as a first-pass filter
for VINs that were entered (often scanned, but occasionally
hand-keyed).  In some environments, I've been able to intercept I/O/Q
and remap them accordingly to 1/0/0 to do the disambiguation for the
user.  So I'd not want to see other character-classes touched, as
they can be perfectly legit.

-tkc

¹ http://en.wikipedia.org/wiki/Vehicle_Identification_Number



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


Thread

re Questions Blake Adams <blakesadams@gmail.com> - 2014-01-26 08:59 -0800
  Re: re Questions Larry Martell <larry.martell@gmail.com> - 2014-01-26 10:06 -0700
    Re: re Questions Blake Adams <blakesadams@gmail.com> - 2014-01-26 09:15 -0800
  Re: re Questions Chris Angelico <rosuav@gmail.com> - 2014-01-27 04:08 +1100
    Re: re Questions Roy Smith <roy@panix.com> - 2014-01-26 12:15 -0500
      Re: re Questions Chris Angelico <rosuav@gmail.com> - 2014-01-27 04:25 +1100
      Re: re Questions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-26 17:39 +0000
      Re: re Questions Tim Chase <python.list@tim.thechases.com> - 2014-01-26 13:41 -0600
    Re: re Questions Blake Adams <blakesadams@gmail.com> - 2014-01-26 09:15 -0800
      Re: re Questions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-26 17:30 +0000

csiph-web