Fix format regex error that will match all inputs

This commit is contained in:
Dian Qi 2023-06-04 20:30:03 +08:00
parent e52d3bbbc9
commit 472879f9b2

View File

@ -6,7 +6,7 @@ import useFocus from './clipboardWatch';
function formatReg(regStr) {
const flags = regStr.replace(/.*\/([gimy]*)$/, '$1');
const pattern = flags.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1');
const pattern = regStr.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1');
return new RegExp(pattern, flags);
}