Ask for a rule.

requirements:
customize the delimiter to split the string that meets the following requirements.

  1. string in double quotes, ignoring delimiters. For example, a code b, "c code d" splits to get ["afield," bake,"c < d "] < / parse >
  2. Units within a
  3. string may or may not contain double quotation marks. Such as a code b, "centerd", "e", "f < g", h < / gr >.
The

delimiter is not necessarily a comma, it is custom, it can be a space, it can be any character in amurz. That is, the process of regular generation is probably in the following form:

var splitBy = ","
var reg = new Reg(`...${split}...`)

you can provide some sample strings as verification samples:

comma separator: (half-width comma, (in English)
"rule_id", "time,ti", "module", "dst_port", "nat_src_ip", "nat_src_port", "nat_dst_ip", "nat_dst_port", "comment", "src_mac", "dst_mac", "user", "app_name", "app_id", "category", "subcategory", "risk", "tags", "technology", "mid_session", "1", "1415171952", "fw", "G11A-A0-A9-EA-B9 1", "", "accept", "tcp", "10.10.20.3", "19079", "10.10.14.211", "1521", "00-19-B9-3D-DB-41", "00-1A-A0-A9-EA-B9", "1", ""

"

space separator:
a b "cc d"s ccc" dddd cccccs


str.match(new RegExp(`"[^"]+"|[^${split}]+`, 'g'))
Menu