This project has moved and is read-only. For the latest updates, please go here.

Replace Tabs

Sep 2, 2016 at 4:04 PM
I need to search for tab characters in a document and replace it. I tried doing "\t" and "\t" but it doesn't do any replacements when I do that. Is there something special I need to do to identify a tab character? Can anyone provide an example?
Sep 3, 2016 at 12:59 PM
After debugging through the code, I found that the defaults used with ReplaceText that escapes the pattern used to for the search was being thrown off. This was because when I pass in "\t" it would see the "\" and escape it so that it thought I was looking for the literal backslash character followed by the letter "t". I had to set the "escapeRegEx" parameter to "false" and the it would take the "\t" as-is instead of trying to escape it. The side effect of that is that I would then have to make sure to do all of my own escaping. So in my case I needed to find a tab followed by a $, so I had to pass in "\t\$" to properly match. It would be nicer if the escaping logic would be smart enough so that it would not escape sequences that are for special characters such as \t or \w etc since you would never need to "escape" the letter "t".
Marked as answer by hafnera on 9/3/2016 at 4:59 AM