node-passbook icon indicating copy to clipboard operation
node-passbook copied to clipboard

Signature parsing with regular expression failure

Open poojagurubasappa opened this issue 6 years ago • 2 comments

The regular expression used for splitting the signature accesses index 3. stdout.split(/(\r\n|\n\n)/)[3];

This is breaking since the regular expression doesnt work as expected. The signature is actually present at index 6.

poojagurubasappa avatar Mar 18 '19 12:03 poojagurubasappa

The issue is not with the index. The issue is with the regular expression itself. it should have been var signature = stdout.split(/(\r\n\r\n|\n\n)/)[3];

#64 broke this in 2.2.0 release.

daniepaul avatar Apr 11 '19 04:04 daniepaul

The regular expression is capturing '\r\n' and '\n\n'. Therefore 3 more captured line breaks are in the result array of stdout.split(/(\r\n\r\n|\n\n)/) and the signature appears in position 6 instead of 3.

I am having success by removing the bracket in the regular expression. var signature = stdout.split(/\r\n|\n\n/)[3];

vodaben avatar May 28 '19 09:05 vodaben