POSIX character classes
Java already has support for POSIX character classes using the \p operator. RegExPlus adds support for them using the [:class:] POSIX bracket expressions.
Syntax
Tutorials
- POSIX character classes on www.regular-expressions.info
- Search for POSIX CHARACTER CLASSES (copy) in the PCRE docs
- Post your own link in the forums
\p{class}
Java already has support for POSIX character classes via the \p operator.
As an example, 0x\p{XDigit}++ will match a hex
number, for example, 0xFF.
In the Pattern class api is a list of the supported class names along with a list of the characters that they match.
[:class:]
RegExPlus adds support for POSIX classes in the form [:class:]. This is the same form support by PCRE and Ruby.
As an example, 0x[[:xdigit:]]++ will match a hex
number, for example, 0xFF.
In the Pattern class api is a list of the supported class names along with a list of the characters that they match.
[:class:] outside of a character class
Note that unlike the \p{class} syntax, the [:class:] syntax is only allowed within a character class. If used outside a character class, a PatternSyntaxException will be thrown.
For example, if you accidently forget to put the expression in a character
class, 0x[:xdigit:]++, an exception will be thrown.
See
the results on JavaStar.
