Is this a bug in .NET's Regex.Split?

≯℡__Kan透↙ 提交于 2019-11-28 13:51:24

From the documentation for Regex.Split

If capturing parentheses are used in a Regex.Split expression, any captured text is included in the resulting string array.

The internal parentheses are capturing. Try using (?:[^,],) instead.

From docs:

If capturing parentheses are used in a Regex.Split expression, any captured text is included in the resulting string array.

You have a capture group in your second expression. Try non-capturing parens:

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