RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Text File Parser - splits on unquoted \n - ' or " mixed - backslash escape - \r\n okay
Expression
/^("(\\"|[^"])*"|'(\\'|[^'])*'|[^\n])*(\n|$)/gm
Description
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 Example is ready for enclosure in single quotes. Output from Matching Example: [0]=a " b [\n] " 'c[\n]' [\n] [1]= "a \" ' " b 'c " \' ' [\n] [2]= Line3...
Matches
a " b \n " \'c\n\' \n "a \\" \' " b \'c " \\\' \' \n Line3...
Non-Matches
matches all
Author Rating: Not yet rated. Brian \S\s
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials