【发布时间】:2022-12-21 22:41:07
【问题描述】:
我正在使用以下正则表达式来检查以逗号分隔的数字字符串是否匹配。
^\\d+(,\\d+)*$
但是声纳显示以下错误。
Refactor this repetition that can lead to a stack overflow for large inputs.
我怎样才能解决这个问题?
例子
",3" -> not match
"3,3" -> match
"3,3," -> not match
"," -> not match
"1" -> match
"a,1" -> not match
【问题讨论】:
-
您的正则表达式模式没有任何问题,我建议在 SonarQube 中关闭此规则,或者添加一个例外。
标签: regex sonarqube stack-overflow