[Python-ideas] Ignorable whitespaces in the re.VERBOSE mode

M.-A. Lemburg mal at egenix.com
Mon Nov 20 04:20:13 EST 2017


For consistency, we should probably have "whitespace" for re
equal to whatever "\s" matches, since this is what the engine
itself considers as whitespace (and then also covers the special
case where you use the re.ASCII flag).

Still, the only practical case I could imagine, where extending the
list would indeed make sense, is to have the   character qualify
as whitespace for re.VERBOSE, since this can sometimes be introduced
via copy&paste from other sources (e.g. web pages showing a
regular expression).

Due to whitespace being what it is, it's hard to tell whether you've
just copied a \u0020 or a \u00a0. The latter can easily render the
regular expression non-working with the current interpretation of
re.VERBOSE.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Nov 20 2017)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...           http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/
                      http://www.malemburg.com/



More information about the Python-ideas mailing list