Escape sequence - New Line character \n

Q

What is the escape sequence for the New Line or Line Feed character?

How to write a regular expression to capture the last character before the New Line character?

✍: FYIcenter.com

A

The escape sequence for the New Line or Line Feed character is \n, which is the same as \x0A.

The regular expression to capture the last character before the New Line character is:

(.|)\n

(.|)   - captures a character or nothing
\n     - matches the New Line character

Click the button to test this regular expression here online:

2013-01-26, 0👍, 0💬