Escape sequence - Character in octal \... \o{...}

Q

What is the escape sequence for a character written in octal format?

How to write a regular expression to capture the escape (Backslash) \ character in a string like: \x5C

✍: FYIcenter.com

A

The escape sequence for any character in octal number format is '\...' or \o{...}, '...' is the 3 octal digits. For example:

\063      - matches '3' character
\015      - matches the Carriage Return character
\x{012}   - matches the Line Feed character

The regular expression to capture the escape \ character is:

\134

\134   - matches the Backslash character \ using octal digits

Click the button to test this regular expression here online:

2013-01-26, 2593👍, 0💬