Regular expression & new lines

 Code Inquisitor  Comments Off on Regular expression & new lines
Aug 252009
 

Windows line breaks are LF (\r) followed by a CR (\n), so to match a line break in windows use the regular expression \r\n.

If you have a line break, $ will match before the line break, and ^ after it.

You can match a CR (\r) not followed by LF (\n) with \r(?!\n).

UNIX uses an LF character only.

Apple uses a CR character only.

 Posted by on August 25 2009  Tagged with: