minor regex fix

This commit is contained in:
Ben Zörb 2016-04-18 16:36:33 +02:00
parent 35058fa8fd
commit f724f3f91b

View File

@ -62,9 +62,9 @@ function read(file) {
* @param $el
*/
function getIndent(html, $el) {
var regName = new RegExp(_.get($el, 'name'));
var regHref = new RegExp(_.get($el, 'attribs.href'));
var regRel = new RegExp(_.get($el, 'attribs.rel'));
var regName = new RegExp(_.escapeRegExp(_.get($el, 'name')));
var regHref = new RegExp(_.escapeRegExp(_.get($el, 'attribs.href')));
var regRel = new RegExp(_.escapeRegExp(_.get($el, 'attribs.rel')));
var lines = _.filter(html.split(/[\r\n]+/), function (line) {
return regName.test(line) && regHref.test(line) && regRel.test(line);
});