mirror of
https://github.com/mrabarnett/mrab-regex.git
synced 2025-10-05 20:02:39 +02:00
Git issue 546: Partial match not working in some instances with non-greedy capture
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
Version: 2024.11.6
|
||||
|
||||
Git issue 546: Partial match not working in some instances with non-greedy capture
|
||||
|
||||
Version: 2024.9.14
|
||||
|
||||
Reverted to actions/download-artifact@v3 and actions/upload-artifact@v3 in main.yml because GitHub Actions failed when using them.
|
||||
|
@@ -16535,9 +16535,6 @@ backtrack:
|
||||
RE_PARTIAL_RIGHT)
|
||||
return RE_ERROR_PARTIAL;
|
||||
|
||||
if (pos >= limit)
|
||||
break;
|
||||
|
||||
/* Look for the tail string. */
|
||||
found = string_search(state, test, pos + 1, limit +
|
||||
length, TRUE, &is_partial);
|
||||
@@ -16593,9 +16590,6 @@ backtrack:
|
||||
RE_PARTIAL_RIGHT)
|
||||
return RE_ERROR_PARTIAL;
|
||||
|
||||
if (pos >= limit)
|
||||
break;
|
||||
|
||||
/* Look for the tail string. */
|
||||
found = string_search_fld(state, test, pos + 1, limit,
|
||||
&new_pos, &is_partial);
|
||||
@@ -16651,9 +16645,6 @@ backtrack:
|
||||
if (pos <= state->text_start && state->partial_side == RE_PARTIAL_LEFT)
|
||||
return RE_ERROR_PARTIAL;
|
||||
|
||||
if (pos <= limit)
|
||||
break;
|
||||
|
||||
/* Look for the tail string. */
|
||||
found = string_search_fld_rev(state, test, pos - 1,
|
||||
limit, &new_pos, &is_partial);
|
||||
@@ -16713,9 +16704,6 @@ backtrack:
|
||||
RE_PARTIAL_RIGHT)
|
||||
return RE_ERROR_PARTIAL;
|
||||
|
||||
if (pos >= limit)
|
||||
break;
|
||||
|
||||
/* Look for the tail string. */
|
||||
found = string_search_ign(state, test, pos + 1, limit +
|
||||
length, TRUE, &is_partial);
|
||||
@@ -16773,9 +16761,6 @@ backtrack:
|
||||
if (pos <= state->text_start && state->partial_side == RE_PARTIAL_LEFT)
|
||||
return RE_ERROR_PARTIAL;
|
||||
|
||||
if (pos <= limit)
|
||||
break;
|
||||
|
||||
/* Look for the tail string. */
|
||||
found = string_search_ign_rev(state, test, pos - 1,
|
||||
limit - length, TRUE, &is_partial);
|
||||
@@ -16833,9 +16818,6 @@ backtrack:
|
||||
if (pos <= state->text_start && state->partial_side == RE_PARTIAL_LEFT)
|
||||
return RE_ERROR_PARTIAL;
|
||||
|
||||
if (pos <= limit)
|
||||
break;
|
||||
|
||||
/* Look for the tail string. */
|
||||
found = string_search_rev(state, test, pos - 1, limit -
|
||||
length, TRUE, &is_partial);
|
||||
|
@@ -241,7 +241,7 @@ __all__ = ["cache_all", "compile", "DEFAULT_VERSION", "escape", "findall",
|
||||
"VERSION1", "X", "VERBOSE", "W", "WORD", "error", "Regex", "__version__",
|
||||
"__doc__", "RegexFlag"]
|
||||
|
||||
__version__ = "2.5.147"
|
||||
__version__ = "2.5.148"
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Public interface.
|
||||
|
@@ -4346,6 +4346,16 @@ thing
|
||||
self.assertEqual(regex.match(r"(?i)[^/]*b/xyz", "b/xy", partial=True).span(), (0, 4))
|
||||
self.assertEqual(regex.match(r"(?i)[^/]*b/xyz", "b/yz", partial=True), None)
|
||||
|
||||
# Git issue 546: Partial match not working in some instances with non-greedy capture
|
||||
self.assertEqual(bool(regex.match(r'<thinking>.*?</thinking>', '<', partial=True)), True)
|
||||
self.assertEqual(bool(regex.match(r'<thinking>.*?</thinking>', '<thinking', partial=True)), True)
|
||||
self.assertEqual(bool(regex.match(r'<thinking>.*?</thinking>', '<thinking>', partial=True)), True)
|
||||
self.assertEqual(bool(regex.match(r'<thinking>.*?</thinking>', '<thinking>x', partial=True)), True)
|
||||
self.assertEqual(bool(regex.match(r'<thinking>.*?</thinking>', '<thinking>xyz abc', partial=True)), True)
|
||||
self.assertEqual(bool(regex.match(r'<thinking>.*?</thinking>', '<thinking>xyz abc foo', partial=True)), True)
|
||||
self.assertEqual(bool(regex.match(r'<thinking>.*?</thinking>', '<thinking>xyz abc foo ', partial=True)), True)
|
||||
self.assertEqual(bool(regex.match(r'<thinking>.*?</thinking>', '<thinking>xyz abc foo bar', partial=True)), True)
|
||||
|
||||
def test_fuzzy_ext(self):
|
||||
self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', 'e')),
|
||||
True)
|
||||
|
Reference in New Issue
Block a user