-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSplit_CSV,_TSV,_and_the_like_files.md.html
52 lines (51 loc) · 1.63 KB
/
Split_CSV,_TSV,_and_the_like_files.md.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=yes"
/>
<title>Split_CSV,_TSV,_and_the_like_files.md</title>
<style type="text/css">
code {
white-space: pre-wrap;
}
span.smallcaps {
font-variant: small-caps;
}
span.underline {
text-decoration: underline;
}
div.column {
display: inline-block;
vertical-align: top;
width: 50%;
}
</style>
</head>
<body>
<h2
id="comma-separated-values-semi-colon-when-not-surrounded-by-single-or-double-quotes"
>
Comma-separated values, semi-colon when not surrounded by single or double
quotes
</h2>
<pre><code>[^,"']+|"([^"]*)"|'([^']*)'
[^,"']+|"([^"]*)"|'([^']*)'</code></pre>
<p>..</p>
<h2
id="tab-separated-values-when-not-surrounded-by-single-or-double-quotes"
>
Tab-separated values when not surrounded by single or double quotes
</h2>
<pre><code>[^\t"']+|"([^"]*)"|'([^']*)'
[^\s"']+|"([^"]*)"|'([^']*)'</code></pre>
<h2 id="drop-in-csvtsv-pattern">Drop-in csv/tsv pattern</h2>
<pre><code>/\t(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/gm;</code></pre>
<p>
Just replace the first character, that acts as a separator (here, a tab).
</p>
</body>
</html>