0.1.1 • Published 6 years ago
@regexp-extra/html-comment v0.1.1
RegExp for matching HTML comment.
const HTML_COMMENT = require('@regexp-extra/html-comment');
// -> regular expression (global)
HTML_COMMENT.test('<button>lucky</button>');
// false
var str = '<button><!--feeling --><!--very -->lucky</button>';
HTML_COMMENT.test(str);
// true
str.match(HTML_COMMENT);
// [ '<!--feeling -->', '<!--very -->' ]
new RegExp(HTML_COMMENT).exec(str);
// [ '<!--feeling -->',
// 'feeling ',
// index: 8,
// input: '<button><!--feeling --><!--very -->lucky</button>',
// groups: undefined ]
credits: taken directly from stevemao/html-comment-regex.