Skip to content

Commit d5a766f

Browse files
smartycopemichaelmior
authored andcommitted
Added EZRegex pattern for the split extension regex
1 parent 6bac2be commit d5a766f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

jsonpath_ng/ext/string.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@
1616

1717

1818
SUB = re.compile(r"sub\(/(.*)/,\s+(.*)\)")
19-
SPLIT = re.compile(r"split(?:\s+)?\((?:\s+)?(?P<j>(?:(?:'|\"))?)(.+)(?P=j)(?:\s+)?,(?:\s+)?((?:(?:\-)?\d+|\*))(?:\s+)?,(?:\s+)?((?:\-)?\d+)(?:\s+)?\)")
19+
# Regex generated using the EZRegex package (ezregex.org)
20+
# EZRegex code:
21+
# param1 = group(optional(either("'", '"')), name='quote') + group(chunk) + earlier_group('quote')
22+
# param2 = group(either(optional('-') + number, '*'))
23+
# param3 = group(optional('-') + number)
24+
# pattern = 'split' + ow + '(' + ow + param1 + ow + ',' + ow + param2 + ow + ',' + ow + param3 + ow + ')'
25+
SPLIT = re.compile(r"split(?:\s+)?\((?:\s+)?(?P<quote>(?:(?:'|\"))?)(.+)(?P=quote)(?:\s+)?,(?:\s+)?((?:(?:\-)?\d+|\*))(?:\s+)?,(?:\s+)?((?:\-)?\d+)(?:\s+)?\)")
2026
STR = re.compile(r"str\(\)")
2127

2228

0 commit comments

Comments
 (0)