I'm trying to take some text that's in a format where all the spacing, tabs, newlines (control-characters - NPCs) are present. And have it output in a file in Intellij as those control characters would dictate they be formatted.
I may be going about it in a completely daft way. Tell me if I am. What I was trying to do was use the regex replace functionality to select all the control character representations and then replace them with their actual corresponding control characters.
The problem I ran into was I was trying to use regex groups/sets to grab the character and then simply have the replacement be-
\$1
Of course the problem with that is that the slash escapes the dollar sign which I am intending to use to reference the regex group rather than escaping the dollar sign.
I feel like I'm just terribly ignorant of something that should make this far simpler. I'm aware of my ignorance.
Here's my attempts at it so far
regex of -> "\(.)" to select "\n \r or \t"
and my replacement value of
\$1 converts "\n \r or \t" to "$1 $1 or $1"
but if I replace it with
\$1 then "\n \r or \t" remains "\n \r or \t"
I'm at a loss as to how to make the backslash a backslash as it would function if I just did
\n which would convert "\n \r or \t" to
"
or
"