Regular expression to count number of commas in a string

前端 未结 9 961
故里飘歌
故里飘歌 2020-11-27 05:23

How can I build a regular expression that will match a string of any length containing any characters but which must contain 21 commas?

9条回答
  •  北海茫月
    2020-11-27 05:58

    Might be faster and more understandable to iterate through the string, count the number of commas found and then compare it to 21.

提交回复
热议问题