Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ function edit(regex: string | RegExp, opt = '') {
return obj;
}

const supportsLookbehind = (() => {
// use a default variable to ensure the regex is evaluated on client an not removed by minifiers
const supportsLookbehind = ((a = '') => {
try {
// eslint-disable-next-line prefer-regex-literals
return !!new RegExp('(?<=1)(?<!1)');
return !!new RegExp('(?<=1)(?<!1)' + a);
} catch {
// See browser support here:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Lookbehind_assertion
Expand Down