Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
fix: LEAP-509: Optimize regular expression for improved performance (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
juliosgarbi authored Jan 24, 2024
1 parent fb446c9 commit 4e777d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ export const parseCSV = (text, separator = 'auto') => {

const re = new RegExp(
[
'"(""|[^"]+)*"', // quoted text with possible quoted quotes inside it ("not a ""value""")
'"(?:""|[^"])*"', // quoted text with possible quoted quotes inside it ("not a ""value""")
`[^"${separator}]+`, // usual value, no quotes, between separators
`(?=${separator}(${separator}|$))`, // empty value in the middle or at the end of string
`(?=${separator}(?:${separator}|$))`, // empty value in the middle or at the end of string
`^(?=${separator})`, // empty value at the start of the string
].join('|'),
'g',
Expand Down

0 comments on commit 4e777d3

Please sign in to comment.