fix: Correctly escape RegExp in import tasks

closes #3460
This commit is contained in:
Tom Moor
2022-04-27 23:58:01 -07:00
parent 5f6b6e2879
commit c7e4f491eb
3 changed files with 14 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
import { escapeRegExp } from "lodash";
import * as React from "react";
import replace from "string-replace-to-array";
import styled from "styled-components";
@@ -23,7 +24,7 @@ function Highlight({
regex = highlight;
} else {
regex = new RegExp(
(highlight || "").replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"),
escapeRegExp(highlight || ""),
caseSensitive ? "g" : "gi"
);
}