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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
(?<=,)\s*(?=,)|^(?=,)|[^\"]{2,}(?=\")|([^,\"]+(?=,|$))
Description
Use for parsing CSV files exported from MS Excel, This program adds or not quotes, so it's more complicated.. Use for parsing individual lines, the Regex doesn't capture end of line (supposed to ($) but not made it in the testing so you cannot parse the whole file. Read a line and split it, with this regex
Matches
,Casa en condominio / Traspaso,"$270,000 ","mn,","Toluca,","67 m2
Non-Matches
""
Author Rating: The rating for this expression. itzco calva
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

Title: This works with leading commas also - very helpful
Name: Shad Robinson
Date: 3/9/2017 7:06:34 PM
Comment:
For implementation in c# make the \s be \\s


Title: Incorrectly parses fields containing quotes
Name: Hans
Date: 9/13/2006 1:45:24 AM
Comment:
,"""a", "bb","cc", I have not yet seen one doing it right.


Title: not correct
Name: viktor
Date: 6/29/2005 2:39:03 PM
Comment:
Hi. your expression will not match following example: "$99"",000.00 ",,6/22/2005,AAKO INC DBA,WALDOWSKI,KERRI-ALLYSON,660006408789,,,,


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