skill/Java.Kotlin

java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0

have a nice day :D 2020. 9. 11. 17:37
반응형

* 오류 원인

String[] tmpArr = compare.split("*");

* 해결

String[] tmpArr = compare.split("\\*");

 

* 상세 오류

Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0

*

^

at java.util.regex.Pattern.error(Pattern.java:1957)

at java.util.regex.Pattern.sequence(Pattern.java:2125)

at java.util.regex.Pattern.expr(Pattern.java:1998)

at java.util.regex.Pattern.compile(Pattern.java:1698)

at java.util.regex.Pattern.<init>(Pattern.java:1351)

at java.util.regex.Pattern.compile(Pattern.java:1028)

at java.lang.String.split(String.java:2380)

at java.lang.String.split(String.java:2422)

at page.t_05_1.isStar(t_05_1.java:104)

at page.t_05_1.isCheck(t_05_1.java:46)

at page.t_05_1.main(t_05_1.java:29)

반응형