Commit Graph

120 Commits

Author SHA1 Message Date
Ram Rachum 89a2209ae6
bpo-40016: re docstring: Clarify relationship of inline and argument flags (#19078)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-03-25 14:44:47 -04:00
Serhiy Storchaka 14a0e16c88
bpo-36548: Improve the repr of re flags. (GH-12715) 2019-05-31 10:39:47 +03:00
Serhiy Storchaka e0c19ddc66
bpo-34681: Rename class Pattern in sre_parse to State. (GH-9310)
Also rename corresponding attributes, parameters and variables.
2018-09-18 09:16:26 +03:00
Serhiy Storchaka b931bd0a2f
bpo-32338: OrderedDict import is no longer needed in re. (#4891) 2018-03-11 08:38:13 +02:00
Serhiy Storchaka 05cb728d68
bpo-30349: Raise FutureWarning for nested sets and set operations (#1553)
in regular expressions.
2017-11-16 12:38:26 +02:00
INADA Naoki c1c47c166b bpo-31671: re: Convert RegexFlag to int before compile (GH-3862)
sre_compile does bit test (e.g. `flags & SRE_FLAG_IGNORECASE`) in loop.
`IntFlag.__and__` and `IntFlag.__new__` made it slower.

So this commit convert it to normal int before passing flags to `sre_compile()`.
2017-10-05 17:19:26 +09:00
Serhiy Storchaka 0b5e61ddca bpo-30397: Add re.Pattern and re.Match. (#1646) 2017-10-04 20:09:49 +03:00
Barry Warsaw db50ba7c72 Trivial readability improvement (#3791) 2017-09-27 11:12:30 -04:00
Serhiy Storchaka 114454e9f6 bpo-28293: Don't completely dump the regex cache when full. (#3768) 2017-09-26 19:47:36 +03:00
Serhiy Storchaka 898ff03e1e bpo-30215: Make re.compile() locale agnostic. (#1361)
Compiled regular expression objects with the re.LOCALE flag no longer
depend on the locale at compile time.  Only the locale at matching
time affects the result of matching.
2017-05-05 08:53:40 +03:00
Serhiy Storchaka 5908300e4b bpo-29995: re.escape() now escapes only special characters. (#1007) 2017-04-13 21:06:43 +03:00
Victor Stinner fb6a6596b5 Issue #28637: Reapply changeset 223731925d06
"issue28082: use IntFlag for re constants" by Ethan Furman.

The re module is not more used in the site module and so adding "import enum"
to re.py doesn't impact python_startup benchmark anymore.
2016-11-14 12:35:55 +01:00
Victor Stinner 1ec1cd161b Issue #28637: Revert issue #28082, don't import enum in re
Importing the enum module in the re module slows down Python startup by 34%
when Python is run from a virtual environment, or more generally when the re
module is imported at startup but not the enum module.
2016-11-08 00:42:46 +01:00
Raymond Hettinger 5820f3a381 Issue #28193: Use lru_cache in the re module. 2016-09-18 20:17:21 -07:00
Ethan Furman 722898065c issue28082: better name for Flag 2016-09-11 14:54:27 -07:00
Ethan Furman f93395bc51 issue28082: use IntFlag for re constants 2016-09-11 13:30:08 -07:00
Serhiy Storchaka be9a4e5c85 Issue #433028: Added support of modifier spans in regular expressions. 2016-09-10 00:57:55 +03:00
Serhiy Storchaka ccd047ea4b Removed unused imports. 2016-04-25 00:12:32 +03:00
Serhiy Storchaka 632a77e6a3 Issue #22364: Improved some re error messages using regex for hints. 2015-03-25 21:03:47 +02:00
Serhiy Storchaka 4eea62fd2e Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
2015-02-21 10:07:35 +02:00
Benjamin Peterson 16e802f4ae merge 3.4 (#9179) 2014-11-30 11:51:16 -05:00
Benjamin Peterson 66323415c7 backout 9fcf4008b626 (#9179) for further consideration 2014-11-30 11:49:00 -05:00
Serhiy Storchaka ab14088141 Minor code clean up and improvements in the re module. 2014-11-11 21:13:28 +02:00
Serhiy Storchaka 6276b32799 Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
2014-11-07 21:45:17 +02:00
Serhiy Storchaka 84df7fe6a2 Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
2014-11-07 21:43:57 +02:00
Serhiy Storchaka 3bf7a6c1da Fixed compile error in issue #22410. The _locale module is optional. 2014-10-31 01:37:03 +02:00
Serhiy Storchaka cf7b1cadd1 Fixed compile error in issue #22410. The _locale module is optional. 2014-10-31 01:34:45 +02:00
Serhiy Storchaka 7cc0a1f7cb Issue #22410: Module level functions in the re module now cache compiled
locale-dependent regular expressions taking into account the locale.
2014-10-31 00:56:45 +02:00
Serhiy Storchaka 4659cc0756 Issue #22410: Module level functions in the re module now cache compiled
locale-dependent regular expressions taking into account the locale.
2014-10-31 00:53:49 +02:00
Serhiy Storchaka 4d75a01798 Issue #22510: Get rid of little overhead of testing re.DEBUG flag. 2014-09-29 18:13:02 +03:00
Serhiy Storchaka be4de52fb1 Removed a code for suport Python version <2.2. 2014-09-28 15:36:18 +03:00
Antoine Pitrou c49672f25e Issue #20426: When passing the re.DEBUG flag, re.compile() displays the debug output every time it is called, regardless of the compilation cache. 2014-02-03 21:01:35 +01:00
Antoine Pitrou d2cc743ca4 Issue #20426: When passing the re.DEBUG flag, re.compile() displays the debug output every time it is called, regardless of the compilation cache. 2014-02-03 20:59:59 +01:00
Serhiy Storchaka 32eddc1bbc Issue #16203: Add re.fullmatch() function and regex.fullmatch() method,
which anchor the pattern at both ends of the string to match.

Original patch by Matthew Barnett.
2013-11-23 23:20:30 +02:00
Georg Brandl daa1fa991c Back out accidentally pushed changeset b51218966201. 2013-10-13 09:32:59 +02:00
Georg Brandl 4300019e1a Add re.fullmatch() function and regex.fullmatch() method, which anchor the
pattern at both ends of the string to match.

Patch by Matthew Barnett.
Closes #16203.
2013-10-13 09:18:45 +02:00
Christian Heimes ad9c9bb5a9 Remove import functools from re module. The re module imports functools but never uses it. 2013-10-13 02:00:09 +02:00
Serhiy Storchaka 969ff72642 Issue #16564: Fixed a performance regression relative to Python 3.1 in the
caching of compiled regular expressions.
2013-03-16 22:53:48 +02:00
Serhiy Storchaka 0f606a636a Issue #16564: Fixed a performance regression relative to Python 3.1 in the
caching of compiled regular expressions.
2013-03-16 22:52:09 +02:00
Raymond Hettinger d0dbb20f5f Set cache sizes to a power-of-two 2013-02-17 01:33:37 -08:00
Ezio Melotti d68ac85e9a #14236: merge with 3.2. 2012-04-29 13:37:13 +03:00
Ezio Melotti 3899283670 #14236: fix docs for \S. 2012-04-29 13:35:55 +03:00
Ezio Melotti 660a949720 #14236: merge with 3.2. 2012-04-29 08:24:02 +03:00
Ezio Melotti e990092fd0 #14236: mention Unicode whitespace in \s documentation. 2012-04-29 08:23:25 +03:00
Georg Brandl 6aacc14e29 Merge with 3.2. 2012-03-10 09:27:30 +01:00
Georg Brandl e144c74e02 Closes #14244: add info about capturing groups and maxsplit to the docstring of re.split(). 2012-03-10 09:26:53 +01:00
Florent Xicluna aabbda5354 Merge 3.2 2011-10-28 14:52:29 +02:00
Florent Xicluna 5d1155c08e Closes #13258: Use callable() built-in in the standard library. 2011-10-28 14:45:05 +02:00
Raymond Hettinger cd9fdfd652 Issue 13227: Option to make the lru_cache() type specific (suggested by Andrew Koenig). 2011-10-20 08:57:45 -07:00
Ezio Melotti 88fdeb45ef #2650: re.escape() no longer escapes the "_". 2011-04-10 12:59:16 +03:00