let me know how can i escape the space in between, it may confuse , even if “\ “ is equivalent to “ “, rest for all special character i want to put a “\”
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\{\}
What extra expression do i need to provide in addition of ([^a-zA-Z0-9])
Add the space to the negated character class so it will not be escaped: