Skip to content

Commit af258ff

Browse files
Allow to detect matching group in finditer_with_separators().
1 parent c88d0c5 commit af258ff

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

django_jinja_knockout/utils/regex.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# https://regexr.com
2+
class MatchGroup(str):
3+
pass
4+
5+
16
# regex can be without capturing group.
27
def finditer_with_separators(regex, s):
38
matches = []
@@ -6,7 +11,7 @@ def finditer_with_separators(regex, s):
611
match_start = match.start()
712
if (prev_end != 0 or match_start > 0) and match_start != prev_end:
813
matches.append(s[prev_end:match.start()])
9-
matches.append(match.group())
14+
matches.append(MatchGroup(match.group()))
1015
prev_end = match.end()
1116
if prev_end < len(s):
1217
matches.append(s[prev_end:])

0 commit comments

Comments
 (0)