I'm using this pattern to check if a string starts with at least 2 alphabetic characters in front a colon:
string.matches("^\\p{IsAlphabetic}{2,}:")
but I get the following exception thrown at me:
java.util.regex.PatternSyntaxException: Unknown character property name {Alphabetic} near index 16
^\p{IsAlphabetic}{2,}:
^
at java.util.regex.Pattern.error(Pattern.java:1730)
at java.util.regex.Pattern.charPropertyNodeFor(Pattern.java:2454)
at java.util.regex.Pattern.family(Pattern.java:2429)
at java.util.regex.Pattern.sequence(Pattern.java:1848)
at java.util.regex.Pattern.expr(Pattern.java:1769)
at java.util.regex.Pattern.compile(Pattern.java:1477)
at java.util.regex.Pattern.<init>(Pattern.java:1150)
at java.util.regex.Pattern.compile(Pattern.java:840)
at java.util.regex.Pattern.matches(Pattern.java:945)
at java.lang.String.matches(String.java:2102)
even though the specification of the Pattern classes states:
Binary properties are specified with the prefix Is, as in IsAlphabetic. The supported binary properties by Pattern are
- Alphabetic
- Ideographic
- Letter
- ...
and the section Classes for Unicode scripts, blocks, categories and binary properties lists
\p{IsAlphabetic} An alphabetic character (binary property)