From 2c41280b2c1845d40a8c22058c1ab7fa8966cb54 Mon Sep 17 00:00:00 2001 From: Michael Scovetta Date: Thu, 7 Feb 2019 11:57:04 -0800 Subject: [PATCH] Fix incorrect regular expression. The regular expression includes pipes in the alternation, which means it matches literal pipes. It also doesn't correctly split by \r\n (splitting out an extra empty string). Test cases at https://repl.it/repls/KeyEqualUtility. I have not tested this within the context of the application. --- src/arduino/board.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arduino/board.ts b/src/arduino/board.ts index 39908022..33fdb154 100644 --- a/src/arduino/board.ts +++ b/src/arduino/board.ts @@ -8,7 +8,7 @@ export function parseBoardDescriptor(boardDescriptor: string, plat: IPlatform): const boardLineRegex = /([^\.]+)\.(\S+)=(.+)/; const result = new Map(); - const lines = boardDescriptor.split(/[\r|\r\n|\n]/); + const lines = boardDescriptor.split(/\r?\n/); const menuMap = new Map(); lines.forEach((line) => {