Priority in regex manipulating

后端 未结 4 826
[愿得一人]
[愿得一人] 2021-01-26 15:28

I write some java code to split string into array of string. First, I split that string using regex pattern \"\\\\,\\\\,|\\\\,\" and then I split using pattern

4条回答
  •  醉酒成梦
    2021-01-26 16:23

    Case 1: Split by ,, else ,
    This gets only first case, the rest split by ,.

    Case 2: Split by , else ,,
    gets all cases. So ,, gets split into word and ,word.
    Then ,word gets split into " " and word.

提交回复
热议问题