What is the difference between \\r and \\n in a regular expression?
Can someone explain it with an example?
Normally \r represents a carriage return character (ASCII 0x0d), and \n is a newline character (ASCII 0x0a). This page has a list of all the special characters, quoted here for completeness:
\fmatches form-feed.\rmatches carriage return.\nmatches linefeed.\tmatches horizontal tab.\vmatches vertical tab.\0matchesNULcharacter.[\b]matches backspace.\smatches whitespace (short for[\f\n\r\t\v\u00A0\u2028\u2029]).\Smatches anything but a whitespace (short for[^\f\n\r\t\v\u00A0\u2028\u2029]).\wmatches any alphanumerical character (word characters) including underscore (short for[a-zA-Z0-9_]).\Wmatches any non-word characters (short for[^a-zA-Z0-9_]).\dmatches any digit (short for[0-9]).\Dmatches any non-digit (short for[^0-9]).\bmatches a word boundary (the position between a word and a space).\Bmatches a non-word boundary (short for[^\b]).\cXmatches a control character. E.g:\cmmatchescontrol-M.\xhhmatches the character with two characters of hexadecimal codehh.\uhhhhmatches the Unicode character with four characters of hexadecimal codehhhh.