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

Commit

Permalink
(#231) simplify regex compacting expression in createRegexRestore
Browse files Browse the repository at this point in the history
Previously this expression contains a fragment similar to /aa*/ - have simplified this to /a+/.
  • Loading branch information
mtlewis committed Oct 26, 2016
1 parent f91377b commit c3ad4d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export function createRegExpRestore () {
// Any attempts to simplify this regex are encouraged! A replacement
// regex should match the strings "a\\\(\\\)\\" and "a\\\)\\\(" in the
// test string "a\\\(\\\)\\(a\\\)\\\()".
exprStr = exprStr.replace(/((^|[^\\])(\\\\)*\\[()]((\\\\)*\\[()])*|[^()])+/g, (match) => {
exprStr = exprStr.replace(/((^|[^\\])((\\\\)*\\[()])+|[^()])+/g, (match) => {
return `[\\s\\S]{${match.replace(/\\(.)/g, '$1').length}}`;
});

Expand Down

0 comments on commit c3ad4d4

Please sign in to comment.