Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit c3ad4d4

Browse files
committed
(#231) simplify regex compacting expression in createRegexRestore
Previously this expression contains a fragment similar to /aa*/ - have simplified this to /a+/.
1 parent f91377b commit c3ad4d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export function createRegExpRestore () {
193193
// Any attempts to simplify this regex are encouraged! A replacement
194194
// regex should match the strings "a\\\(\\\)\\" and "a\\\)\\\(" in the
195195
// test string "a\\\(\\\)\\(a\\\)\\\()".
196-
exprStr = exprStr.replace(/((^|[^\\])(\\\\)*\\[()]((\\\\)*\\[()])*|[^()])+/g, (match) => {
196+
exprStr = exprStr.replace(/((^|[^\\])((\\\\)*\\[()])+|[^()])+/g, (match) => {
197197
return `[\\s\\S]{${match.replace(/\\(.)/g, '$1').length}}`;
198198
});
199199

0 commit comments

Comments
 (0)