mirror of
https://github.com/python/cpython.git
synced 2025-10-05 14:41:07 +00:00
bpo-30157: Fix csv.Sniffer.sniff() regex pattern. (GH-5601) (GH-5602)
Co-authored-by: Jake Davis <jcdavis@awedge.net>
(cherry picked from commit 2411292ba8
)
This commit is contained in:
parent
7df80492fc
commit
2ef69a1d45
4 changed files with 14 additions and 1 deletions
|
@ -217,7 +217,7 @@ class Sniffer:
|
|||
matches = []
|
||||
for restr in (r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)', # ,".*?",
|
||||
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)', # ".*?",
|
||||
r'(?P<delim>>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)', # ,".*?"
|
||||
r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)', # ,".*?"
|
||||
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)'): # ".*?" (no delim, no space)
|
||||
regexp = re.compile(restr, re.DOTALL | re.MULTILINE)
|
||||
matches = regexp.findall(data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue