DevEco Studio NEXT Developer Beta1
Build #DS-233.14475.28.36.503403
Build Version: 5.0.3.403, built on June 20, 2024
Runtime version: 17.0.10+1-b1087.17 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Registry:
idea.plugins.compatible.build=IC-233.14475.28
Non-Bundled Plugins:
net.vektah.codeglance2 (1.5.5)
正则表达式:
static readonly SPECIAL_CHARACTER="[`~!@#$%^&*()+=|{}:;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】《》‘;:”“’。,、?]"
我想匹配输入字符中是否包含特殊字符,其中[]这俩特殊字符无法判断出来,
在正则表达式中想要匹配 [ 和 ] 需要用 双斜杠\ \ 双重转义,例如下面demo中,[是可以判断出来的
也可以将特殊字符排除在外
其中 \u4e00-\u9fa5标识汉字,0-9标识数字,A-Za-z标识大写小字母