Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape ^ and $ in export to CSV #1

Open
vlastikw opened this issue Jun 9, 2020 · 1 comment
Open

Escape ^ and $ in export to CSV #1

vlastikw opened this issue Jun 9, 2020 · 1 comment

Comments

@vlastikw
Copy link

vlastikw commented Jun 9, 2020

Hi,
I need to use field separator ^ or $ so I need to replace row
var endregex = new RegExp((FS=="|" ? "\|" : FS)+"+$");
with
var endregex = new RegExp((['|', '^', '$'].indexOf(FS) >= 0 ? '\' + FS : FS)+"+$");

in write_csv_stream and sheet_to_csv in file xlsx.js

Otherwise I get error Invalid regular expression: /^+$/: Nothing to repeat

@Lovygoogle
Copy link

var fs = require('fs');
var array = fs.readFileSync('[filename].txt').toString().split("\n");

for (i in array) {
var index = i.indexOf('+');
var line = i + 1;
console.log('Line ' + line + ' position ' + index);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants