Negation of the preceding regex directives

To match a single character belonging to a particular category, we use the \p{propertyName} directive.

To match a single character not belonging to a particular category, we use the \P{propertyName} directive (note the uppercase P instead of the lowercase p).

Get Java 9 Regular Expressions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.