mirror of
https://github.com/zhigang1992/replace-in-file.git
synced 2026-01-12 17:43:32 +08:00
Support "u" and "s" flags (#97)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Parameters
This commit is contained in:
@@ -33,7 +33,7 @@ options.files = files.reduce((files, file) => {
|
||||
|
||||
//If the isRegex flag is passed, convert the from parameter to a RegExp object
|
||||
if (isRegex) {
|
||||
const flags = from.replace(/.*\/([gimy]*)$/, '$1');
|
||||
const flags = from.replace(/.*\/([gimyus]*)$/, '$1');
|
||||
const pattern = from.replace(new RegExp(`^/(.*?)/${flags}$`), '$1');
|
||||
try {
|
||||
options.from = new RegExp(pattern, flags);
|
||||
|
||||
Reference in New Issue
Block a user