Split a string based on each time a Deterministic Finite Automata reaches a final state?

有些话、适合烂在心里 提交于 2019-12-04 18:34:33

Using regex (unescaped): (?:(?:"[^"]*")|(?:[^,]*))

Use that and call Regex.Matches() which is .NET, or its analog in other platforms.

You could further expand the above to this: ^(?:(?:"(?<Value>[^"]*)")|(?<Value>[^,]*))(?:,(?:(?:"(?<Value>[^"]*)")|(?<Value>[^,]*)))*$

This will parse the whole string in 1 shot, but you need named groups and multi-capture per group for this to work (.NET supports it).

Eligible commas are also followed by an even number of quotes, and VBScript does support lookaheads. Try splitting on this:

",(?=(?:[^""]*""[^""]*"")*[^""]*$)"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!