summaryrefslogtreecommitdiffstats
path: root/Lib/sre.py
Commit message (Collapse)AuthorAgeFilesLines
* Addendum to #764548: restore 2.1 compatibility.Just van Rossum2003-07-021-1/+1
|
* Fix and test for bug #764548:Just van Rossum2003-07-021-2/+2
| | | | | | Use isinstance() instead of comparing types directly, to enable subclasses of str and unicode to be used as patterns. Blessed by /F.
* Add finditer to __all__ (when defining it at all).Guido van Rossum2002-10-141-0/+1
| | | | SF bug 585882. Will forward-port.
* added finditer sanity checkFredrik Lundh2001-10-281-3/+2
|
* (experimental) "finditer" method/function. this works pretty muchFredrik Lundh2001-10-241-0/+10
| | | | | like findall, but returns an iterator (which returns match objects) instead of a list of strings/tuples.
* fixed character set description in docstring (SRE uses PythonFredrik Lundh2001-10-211-80/+15
| | | | | | | | | | | | | | | | | strings, not C strings) removed USE_PYTHON defines, and related sre.py helpers skip calling the subx helper if the template is callable. interestingly enough, this means that def callback(m): return literal result = pattern.sub(callback, string) is much faster than result = pattern.sub(literal, string)
* sre.Scanner fixes (from Greg Chapman). also added a Scanner sanityFredrik Lundh2001-10-211-5/+6
| | | | | | check to the test suite. added a few missing exception checks in the _sre module
* rewrote the pattern.sub and pattern.subn methods in CFredrik Lundh2001-10-211-17/+25
| | | | | | | | | removed (conceptually flawed) getliteral helper; the new sub/subn code uses a faster code path for literal replacement strings, but doesn't (yet) look for literal patterns. added STATE_OFFSET macro, and use it to convert state.start/ptr to char indexes
* SRE bug #441409:Fredrik Lundh2001-10-181-3/+7
| | | | | | | | compile should raise error for non-strings SRE bug #432570, 448951: reset group after failed match also bumped version number to 2.2.0
* fixed #449964: sre.sub raises an exception if the template contains aFredrik Lundh2001-09-181-5/+7
| | | | | | \g<x> group reference followed by a character escape (also restructured a few things on the way to fixing #449000)
* an SRE bugfix a day keeps Guido away...Fredrik Lundh2001-09-181-4/+7
| | | | | | | #462270: sub-tle difference between pre.sub and sre.sub. PRE ignored an empty match at the previous location, SRE didn't. also synced with Secret Labs "sreopen" codebase.
* Convert docstring to "raw" string.Fred Drake2001-09-041-13/+13
|
* Added docstrings by Neal Norwitz. This closes SF bug #450980.Fred Drake2001-09-041-0/+81
|
* Disable the sub() optimization until Fredrik has time to look into SFGuido van Rossum2001-08-101-0/+1
| | | | | | bug #449000, "re.sub(r'\n', ...) broke". This was Fredrik's suggestion -- he's on vacation and said he wouldn't be able to work on this until next week.
* map re.sub() to string.replace(), when possibleFredrik Lundh2001-07-081-12/+17
|
* bug #436596Fredrik Lundh2001-07-061-2/+2
| | | | re.findall doesn't take a maxsplit argument
* sre 2.1b2 update:Fredrik Lundh2001-03-221-1/+21
| | | | | | - take locale into account for word boundary anchors (#410271) - restored 2.0's *? behaviour (#233283, #408936 and others) - speed up re.sub/re.subn
* - restored 1.5.2 compatibility (sorry, eric)Fredrik Lundh2001-02-181-5/+9
| | | | | - removed __all__ cruft from internal modules (sorry, skip) - don't assume ASCII for string escapes (sorry, per)
* bunch more __all__ listsSkip Montanaro2001-02-151-0/+4
| | | | | | also modified check_all function to suppress all warnings since they aren't relevant to what this test is doing (allows quiet checking of regsub, for instance)
* String method conversion.Eric S. Raymond2001-02-091-3/+1
|
* bumped SRE version number to 2.1. cleaned up and added 1.5.2Fredrik Lundh2001-01-161-1/+1
| | | | compatibility patches.
* SRE fixes for 2.1 alpha:Fredrik Lundh2001-01-141-14/+37
| | | | | | | | | | -- added some more docstrings -- fixed typo in scanner class (#125531) -- the multiline flag (?m) should't affect the \Z operator (#127259) -- fixed non-greedy backtracking bug (#123769, #127259) -- added sre.DEBUG flag (currently dumps the parsed pattern structure) -- fixed a couple of glitches in groupdict (the #126587 memory leak had already been fixed by AMK)
* - fixed yet another gcc -pedantic warningFredrik Lundh2000-09-211-0/+5
| | | | | - added experimental "expand" method to match objects - don't use the buffer interface on unicode strings
* -- reset marks if repeat_one tail doesn't matchFredrik Lundh2000-08-071-13/+11
| | | | | | | (this should fix Sjoerd's xmllib problem) -- added skip field to INFO header -- changed compiler to generate charset INFO header -- changed trace messages to support post-mortem analysis
* final 0.9.8 updates:Fredrik Lundh2000-08-011-1/+4
| | | | | -- added REPEAT_ONE operator -- added ANY_ALL operator (used to represent "(?s).")
* SRE 0.9.8: passes the entire test suiteFredrik Lundh2000-08-011-5/+8
| | | | | | | | | -- reverted REPEAT operator to use "repeat context" strategy (from 0.8.X), but done right this time. -- got rid of backtracking stack; use nested SRE_MATCH calls instead (should probably put it back again in 0.9.9 ;-) -- properly reset state in scanner mode -- don't use aggressive inlining by default
* -- SRE 0.9.6 sync. this includes:Fredrik Lundh2000-07-231-9/+24
| | | | | | | | | | | + added "regs" attribute + fixed "pos" and "endpos" attributes + reset "lastindex" and "lastgroup" in scanner methods + removed (?P#id) syntax; the "lastindex" and "lastgroup" attributes are now always set + removed string module dependencies in sre_parse + better debugging support in sre_parse + various tweaks to build under 1.5.2
* - changed sre.Scanner to use lastindex instead of index.Fredrik Lundh2000-07-021-2/+2
|
* - actually enabled charset anchors in the engine (still notFredrik Lundh2000-07-021-0/+31
| | | | | | | | | | used by the code generator) - changed max repeat value in engine (to match earlier array fix) - added experimental "which part matched?" mechanism to sre; see http://hem.passagen.se/eff/2000_07_01_bot-archive.htm#416954 or python-dev for details.
* today's SRE update:Fredrik Lundh2000-07-011-1/+1
| | | | | | | | -- changed 1.6 to 2.0 in the file headers -- fixed ISALNUM macro for the unicode locale. this solution isn't perfect, but the best I can do with Python's current unicode database.
* the mad patcher strikes again:Fredrik Lundh2000-06-301-0/+13
| | | | | | | | | | | | | | | -- added pickling support (only works if sre is imported) -- fixed wordsize problems in engine (instead of casting literals down to the character size, cast characters up to the literal size (same as the code word size). this prevents false hits when you're matching a unicode pattern against an 8-bit string. (unfortunately, this broke another test, but I think the test should be changed in this case; more on that on python-dev) -- added sre.purge function (unofficial, clears the cache)
* - pedantic: make sure "python -t" doesn't complain...Fredrik Lundh2000-06-301-11/+11
|
* - fixed default value handling in group/groupdictFredrik Lundh2000-06-301-1/+1
| | | | - added test suite
* - fixed split behaviour on empty matchesFredrik Lundh2000-06-301-9/+6
| | | | | | - fixed compiler problems when using locale/unicode flags - fixed group/octal code parsing in sub/subn templates
* - fixed another split problemFredrik Lundh2000-06-291-4/+4
| | | | | | | | | (those semantics are weird...) - got rid of $Id$'s (for the moment, at least). in other words, there should be no more "empty" checkins. - internal: some minor cleanups.
* - fixed splitFredrik Lundh2000-06-291-8/+12
| | | | | | | | | | | | | | (test_sre still complains about split, but that's caused by the group reset bug, not split itself) - added more mark slots (should be dynamically allocated, but 100 is better than 32. and checking for the upper limit is better than overwriting the memory ;-) - internal: renamed the cursor helper class - internal: removed some bloat from sre_compile
* towards 1.6b1Fredrik Lundh2000-06-291-6/+17
|
* Fix bug when the replacement template is a callable objectAndrew M. Kuchling2000-06-181-1/+1
|
* Fredrik Lundh: here's the 96.6% version of SREJeremy Hylton2000-06-011-18/+105
|
* I know this is only a temporary stop-gap measure, but the match() andGuido van Rossum2000-05-021-2/+1
| | | | | | search() functions didn't even work because _fixflags() isn't idempotent. I'm adding another stop-gap measure so that you can at least use sre.search() and sre.match() with a zero flags arg.
* Added Fredrik Lundh's sre module and its supporting cast.Guido van Rossum2000-03-311-0/+46
NOTE: THIS IS VERY ROUGH ALPHA CODE!