Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #18 from jharding/support-regex-values-for-regex
Browse files Browse the repository at this point in the history
Support passing in of RegExps for regex property
  • Loading branch information
harthur committed Feb 14, 2013
2 parents 885383c + 17d93a6 commit 1a9854c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ module.exports = function(opts) {
if (options.multiline) {
flags += "m";
}
regex = new RegExp(options.regex, flags);

if (options.regex instanceof RegExp) {
regex = options.regex;
}
else {
regex = new RegExp(options.regex, flags);
}
canReplace = !options.preview && options.replacement !== undefined;

if (options.include) {
Expand Down

0 comments on commit 1a9854c

Please sign in to comment.