Special characters in File Content and Replace
Use character escape sequences in File Content conditions and Replace steps to search for or replace characters that are difficult to enter directly, such as tabs, line breaks, and control characters.
To enable character escapes, click Special symbols (\u) beside the search value in a File Content condition or beside the Find and Replace with fields in a Replace step.
When turned off, escapes are treated as plain text. For example, \n means a backslash followed by n, not a line feed.
Note: Special symbols enables character escape sequences, not regular expressions. Regex patterns such as .* and \s are not interpreted as regex syntax.
Supported escape sequences
| Escape | Meaning |
|---|---|
\a | Bell (U+0007) |
\b | Backspace (U+0008) |
\e | Escape (U+001B) |
\f | Form feed (U+000C) |
\n | Line feed (U+000A) |
\r | Carriage return (U+000D) |
\t | Horizontal tab (U+0009) |
\v | Vertical tab (U+000B) |
\\ | Backslash (\) |
\xNN | Hexadecimal character code, exactly 2 hexadecimal digits. For example, \x09 is a horizontal tab. |
\uNNNN | Unicode code unit, exactly 4 hexadecimal digits. For example, \u0041 is A. |
\cX | ASCII control character specified by X. For example, \cI is a horizontal tab and \cM is a carriage return. |
For \xNN and \uNNNN, use hexadecimal digits 0 to 9, A to F, or a to f. The escape prefixes are lowercase: \x and \u.
For \cX, X can be a letter (A–Z, case-insensitive) or one of these symbols: @, [, \, ], ^, _.
Examples
Replace commas with tabs
To replace commas in file content with horizontal tabs, configure a Replace step:
- Enter
,in Find. - Enter
\tin Replace with and enable its Special symbols (\u) button. - Click Save.
When the task runs, each comma is replaced with a horizontal tab. For example, first,second,third becomes three values separated by tabs. Without Special symbols enabled for Replace with, each comma would be replaced with the literal text \t instead.
Enter a literal backslash
When Special symbols is enabled for a field, enter \\ to represent a single literal backslash. Use this when searching for a backslash or inserting one in replacement text.
To match or insert the two-character text \n, enter \\n. The \\ represents a literal backslash, so the following n remains text rather than forming a line feed.