正则表达式中"\\ p {all}"的含义是什么?

Pen*_*han 6 java regex

我正在使用一些java代码,它具有以下语句:

if (sql1.matches("(?i)^CREATE\\s+TABLE\\p{all}*")) {
     // do something;
}
Run Code Online (Sandbox Code Playgroud)

我搜索了正则表达式语法,找不到使用的规则\\p{all}.那么这个表达的含义是什么?

Wik*_*żew 3

Unicodeall类别“手动”添加到类别列表中以匹配任何字符,包括换行符等。

查看Javaregex源代码:

map.put("all", new CharPropertyFactory() {
                CharProperty make() { return new All(); }});
Run Code Online (Sandbox Code Playgroud)

然后这部分:

/**
 * Implements the Unicode category ALL and the dot metacharacter when
 * in dotall mode.
 */
static final class All extends CharProperty {
    boolean isSatisfiedBy(int ch) {
        return true;
    }
}
Run Code Online (Sandbox Code Playgroud)

All()用于实例化.模式DOTALL,请参阅这部分:

case '.':
    next();
    if (has(DOTALL)) {
        node = new All();
    } ....
Run Code Online (Sandbox Code Playgroud)