これは、\w
意味をエミュレートするために必要な Java コードです。
public final static String
identifier_chars = "\\pL" /* all Letters */
+ "\\pM" /* all Marks */
+ "\\p{Nd}" /* Decimal Number */
+ "\\p{Nl}" /* Letter Number */
+ "\\p{Pc}" /* Connector Punctuation */
+ "[" /* or else chars which are both */
+ "\\p{InEnclosedAlphanumerics}"
+ "&&" /* and also */
+ "\\p{So}" /* Other Symbol */
+ "]";
public final static String
identifier_charclass = "[" + identifier_chars + "]"; /* \w */
public final static String
not_identifier_charclass = "[^" + identifier_chars + "]"; /* \W */
1 つの文字が必要な場所、およびidentifier_charclass
1 つの文字が必要な場所で、パターンで使用します。標準に完全には達していませんが、それらに対する Java の壊れた定義よりもはるかに優れています。\w
not_identifier_charclass
\W