PatternSyntaxException using apache poi

前端 未结 1 1133
小鲜肉
小鲜肉 2020-12-19 18:33

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

相关标签:
1条回答
  • 2020-12-19 19:13

    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}"); 
    
    0 讨论(0)
提交回复
热议问题