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

前端 未结 2 884
醉酒成梦
醉酒成梦 2020-12-11 20:48

I have two regular expressions, for use with Regex.Split:

(?<=\\G[^,],[^,],)

and

(?<=\\G([^,],){2})
         


        
2条回答
  •  甜味超标
    2020-12-11 21:47

    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.

提交回复
热议问题