[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-24 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 3557b05c5a7dfd7d97ddfd3b79aefd53d25e5132 by Serhiy Storchaka in 
branch 'master':
bpo-31690: Allow the inline flags "a", "L", and "u" to be used as group flags 
for RE. (#3885)
https://github.com/python/cpython/commit/3557b05c5a7dfd7d97ddfd3b79aefd53d25e5132


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-05 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Added tests and the documentation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

PR 3885 is a preliminary but working implementation. Needed new tests and 
documentation.

>>> import re
>>> re.findall('(?i:[a-z]+)', ''.join(map(chr, range(0x1
['ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', 'İı', 'ſ', 'K']
>>> re.findall('(?ia:[a-z]+)', ''.join(map(chr, range(0x1
['ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz']

The engine now uses separate opcodes for case-insensitive matching in ASCII, 
UNICODE and LOCALE modes. It may cause small speed up of matching, but slow 
down of compiling.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +3860

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread INADA Naoki

Change by INADA Naoki :


--
keywords: +patch
pull_requests: +3858
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

Currently re supports local inline flags. 'a(?i:b)' matches 'a' 
cases-sensitively, but 'b' case-insensitively. But flags 'a' and 'L' can't be 
scoped to a subpattern. The 'u' flag currently just redundant, it doesn't make 
effect in string patterns, and is not allowed in bytes patterns. They can be 
applied only to the whole pattern. I think it would be nice to make them local.

The example of the problem that this can solve is issue31672. Currently '[a-z]' 
in Unicode case-insensitive mode matches not only Latin letters from ;a' to 'z' 
and from 'A' to 'Z', but also characters 'İ', 'ı', 'ſ' and 'K' which are 
equivalent to 'i', 's' and 'k' correspondingly. With local 'a' and 'u' flags 
you can use ASCII and Unicode ranges in the same pattern.

I'm working on the patch.

--
assignee: serhiy.storchaka
components: Library (Lib), Regular Expressions
messages: 303693
nosy: ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Make RE "a", "L" and "u" inline flags local
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com