Interesting question. I feel the RegEx
is taking hold of you...
Well... \r\n is less characters so many would prefer it for that alone.
However I like representing CRLF as \x0D\x0A in a RegEx pattern because:
- Representing a control char using its hex value is more flexible
- Example: I copy some example code that uses \x0D\x0A
- Now I need to target other control chars, simple, just change the numbers
- Had I just used \r\n I may have forgotten the hex format and would have had to look that up again
- Final reason, in a big long ugly RegEx, \x0D\x0A just pops better, just a little faster/easier to understand when looking at it, in my opinion... but it all comes down to personal choice.
Use whatever works best for you and may the RegEx
be with you!