Java regex is working in my system but not in the server -
the regular expression is
string regex = "^[\\p{ishangul}\\p{isdigit}]+";
and whenever do
text.matches(regex);
it works fine in system not in of system. not able track issue.
thank in advance.
exception:
exception in thread "main" java.util.regex.patternsyntaxexception: unknown character property name {hangul} near index 13 ^[\p{ishangul}\p{isdigit}]+ ^ @ java.util.regex.pattern.error(pattern.java:1713) @ java.util.regex.pattern.charpropertynodefor(pattern.java:2437) @ java.util.regex.pattern.family(pattern.java:2412) @ java.util.regex.pattern.range(pattern.java:2335) @ java.util.regex.pattern.clazz(pattern.java:2268) @ java.util.regex.pattern.sequence(pattern.java:1818) @ java.util.regex.pattern.expr(pattern.java:1752) @ java.util.regex.pattern.compile(pattern.java:1460) @ java.util.regex.pattern.<init>(pattern.java:1133) @ java.util.regex.pattern.compile(pattern.java:823) @ java.util.regex.pattern.matches(pattern.java:928) @ java.lang.string.matches(string.java:2090) @ com.mycompany.helper.applicationhelper.main(applicationhelper.java:200)
it seems java version using not able recognise hangul correct script character can try create own character class cover same range hongul newer versions of java.
from see in code in source code of character.unicodescript
on java 8 hangul refers unicode ranges
1100..11ff
302e..302f
3131..318f
3200..321f
3260..327e
a960..a97f
ac00..d7fb
ffa0..ffdf
so maybe try such pattern
pattern.compile("^[" + "\u1100-\u11ff" + "\u302e-\u302f" + "\u3131-\u318f" + "\u3200-\u321f" + "\u3260-\u327e" + "\ua960-\ua97f" + "\uac00-\ud7fb" + "\uffa0-\uffdf" + "\\p{isdigit}]+");
Comments
Post a Comment