VAMTIGER Regex HTML Stylesheet Link
A regular expression to match a HTML stylesheet link for defined HTML document text.
Installation
VAMTIGER Regex HTML Stylesheet Link can be installed using npm or yarn:
npm i --save vamtiger-regex-html-stylesheet-link
or
yarn add vamtiger-regex-html-stylesheet-link
Usage
Import or require a referece to VAMTIGER Regex HTML Stylesheet Link:
;
or
const regex = default;
VAMTIGER Regex HTML Stylesheet Link can be used to match a HTML stylesheet link for defined HTML document text:
const regex = default; const input = `<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title> Some HTML Title </title> <link href="some/stylesheet/link/index.css" rel="stylesheet"></head><body> <div> Some HTML body inner HTML </div></body></html>`;const match = input; /** * if (match) { * // Yep, the input string has a HTML title * match[1] === '<link href="some/stylesheet/link/index.css" rel="stylesheet">' * } **/
Named capture groups can be referenced when used together with XRegExp:
const XRegExp = ;const regex = default;const input = `<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title> Some HTML Title </title> <link href="some/stylesheet/link/index.css" rel="stylesheet"></head><body> <div> Some HTML body inner HTML </div></body></html>`;const match = XRegExp;// const match: Match = XRegExp.exec(input, regex); // Typescript /** * if (match) { * // Yep, the input string has a HTML title * match.styleSheetLink === '<link href="some/stylesheet/link/index.css" rel="stylesheet">' * } **/