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

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

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

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

and

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


        
2条回答
  •  情歌与酒
    2020-12-11 21:28

    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})
    

提交回复
热议问题