简体   繁体   中英

Can I set 'UNICODE_CHARACTER_CLASS' to All Pattern usages?

Can I set UNICODE_CHARACTER_CLASS flag to ALL Pattern usage in a single point? something like:

Pattern.setDefaultOption(UNICODE_CHARACTER_CLASS);

I think, For java.util.regex.Pattern, the default setting for "UNICODE_CHARACTER_CLASS" is disable, you can only change it when you execute the "Pattern.compile" method providing the "UNICODE_CHARACTER_CLASS" flag, or you could change this seting via the embedded flag expression. See below:

(?idmsuxU-idmsuxU)  Nothing, but turns match flags i d m s u x U on - off
(?idmsux-idmsux:X)      X, as a non-capturing group with the given flags i d m s u x on - off

It seems that there is no setting method to change this default behaviour. Maybe, Specifying this flag may impose a performance penalty. FYI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM