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 live online training, plus books, videos, and digital content from nearly 200 publishers.