I am using Apache POI in two different projects
The first project is a standalone Java application. Everything is fine here.
The second project is an Android
Android is using ICU regex library that is a bit different from Java regex engine.
See this reference:
Unicode scripts, blocks, categories and binary properties are written with the
\p
and\P
constructs as in Perl.\p{prop}
matches if the input has the property prop, while\P{prop}
does not match if the input has that property.
Thus, the pattern should be written as
Pattern nonAlphabeticPattern = Pattern.compile("\\P{L}");