【发布时间】:2017-04-23 13:49:30
【问题描述】:
我想编写一个正则表达式,如果从第 3 列到末尾的任何 csv 文件列是非零值,它将返回 true 所以如果行像
//sample code for which regex needs to be used
121,321,0,0,0,0,0,0 it should return false
121,321,1,0,0,0,0,0 it should return true
121,321,0,0,0,0,1,0 it should return true
public static void main(String[] args) {
String text = "1234,1102,0,0,0,0";
String regex = "";
System.out.println(Pattern.matches(regex, text));
}
我是正则表达式的新手,谁能帮我解决这个问题
【问题讨论】:
-
你尝试过任何正则表达式吗?
-
这样的案例怎么用rejex处理就不用开始了。
-
我认为您不了解此站点的工作原理。我们是一个问答网站,而不是代码编写服务。在我们为您提供帮助之前,您必须向我们表明您已经做出了努力。见:Why is "Can someone help me?" not an actual question?
-
我试过这个 String regex = "[[[0-9]*[[^0]]],]*";但它每次都返回真实