JavaScript match() method (or equivalent) creates an array of lines from a text file. This pattern handles lines ending with \r\n as well as \n at the expense of including the line-ending chars in the output. The Matching Examples are ready for enclosure in single quotes. Output from Matching Example 1: [0]=a " b [\n] " c [\n]
[1]= Line2... [\n]
[2]= Line3...
Output from Matching Example 2: [0]=a " b [\r][\n]" c [\r][\n]
[1]= Line2... [\r][\n]
[2]= Line3... |