为什么\ p {Lu}匹配小写字母?

3 regex powershell character-class

Lu应该代表Letter, Uppercase,但是我得到了意想不到的结果

PS > 'Hello World' -replace '\p{Lu}', 'Z'
ZZZZZ ZZZZZ
Run Code Online (Sandbox Code Playgroud)

可以看出,Lu正在替换上下字符.

§正则表达式类别

§支持的类别

Tim*_*ker 6

使用-creplace.-replace不区分大小写:

PS > 'Hello World' -creplace '\p{Lu}', 'Z'
Zello Zorld
Run Code Online (Sandbox Code Playgroud)