Permalink
Browse files

Escape passed regex

  • Loading branch information...
1 parent c59882c commit ff32b4e2adbac536c69cb1c87071b8f98c09e50a @kpdecker kpdecker committed Apr 7, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 bin/handlebars
View
@@ -116,7 +116,8 @@ if (argv.known) {
}
// Build file extension pattern
-var extension = new RegExp('\\.' + argv.extension + '$');
+var extension = argv.extension.replace(/[\\^$*+?.():=!|{}\-\[\]]/g, function(arg) { return '\\' + arg; });
+extension = new RegExp('\\.' + extension + '$');
var output = [];
if (!argv.simple) {

0 comments on commit ff32b4e

Please sign in to comment.