之外,我还需要提供什么额外的表达式
让我知道如何逃离中间的空格,它可能会混淆,即使"\"相当于",其余的是我想放一个"\"的所有特殊字符
Input
"$An is h(Stack%1231+#$124{}".replaceAll("([^a-zA-Z0-9])", "\\$1" )
output
$An is h(Stack%1231+#$124{}
Desired output should be like this, this is want i want to achieve using regex
$An is h(Stack%1231+#$124{}
除了([^a-zA-Z0-9](
将空格添加到被否定的字符类中,这样它就不会被转义:
[^a-zA-Z0-9 ]