gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 10:45:17 26 4
gpt4 key购买 nike

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

PS > 'Hello World' -replace '\p{Lu}', 'Z'
ZZZZZ ZZZZZ

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

§ Regular Expression Category

§ Supported Categories

最佳答案

使用 -creplace-replace is case-insensitive :

PS > 'Hello World' -creplace '\p{Lu}', 'Z'
Zello Zorld

关于regex - 为什么\p{Lu} 匹配小写字母?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27193452/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com