@byte-this/html-metadata-reader
Advanced tools
{ | ||
"name": "@byte-this/html-metadata-reader", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Read all meta tags and their values from an HTML document without the use of the window object", | ||
@@ -5,0 +5,0 @@ "main": "public-api.js", |
@@ -71,3 +71,6 @@ export class HtmlDocumentMetadataReader { | ||
//split into the key + value pairs | ||
const splitPairs = metaTagRaw.match(/.*?=\s*(?<!\\)(?:\\{2})*("|').*?(?<!\\)(?:\\{2})*("|')/g) || []; | ||
const splitPairs = | ||
//this regex was modified from something found online | ||
//it will match pairs of "" and '' (seperately) after an equal sign and skip over escaped versions | ||
metaTagRaw.match(/((.*?=\s*(?<!\\)(?:\\{2})*(").*?(?<!\\)(?:\\{2})*("))|.*?=\s*(?<!\\)(?:\\{2})*(').*?(?<!\\)(?:\\{2})*('))/g) || []; | ||
//split into key="" value="" strings | ||
@@ -74,0 +77,0 @@ //if it is a key value only, handle special case |
23293
1.01%515
0.59%