使用此[0-9]+_[0-9]+_[0-9]+(_[0-9]+){0,1}
正則表達式時會引發以下異常。Java正則表達式問題
Caused by: java.util.regex.PatternSyntaxException: Unclosed counted closure near index 31
[0-9]+_[0-9]+_[0-9]+(_[0-9]+){0
^
at java.util.regex.Pattern.error(Pattern.java:1713)
at java.util.regex.Pattern.closure(Pattern.java:2759)
at java.util.regex.Pattern.group0(Pattern.java:2537)
at java.util.regex.Pattern.sequence(Pattern.java:1806)
at java.util.regex.Pattern.expr(Pattern.java:1752)
at java.util.regex.Pattern.compile(Pattern.java:1460)
at java.util.regex.Pattern.<init>(Pattern.java:1133)
at java.util.regex.Pattern.compile(Pattern.java:823)
我正在閱讀XML文件。
顯示的代碼使用 – pstr 2013-02-12 13:20:02
我用Java標準Pattern.compile和Pattern.matcher在代碼。 – shazin 2013-02-12 13:34:04