ECMAScript (JavaScript, ActionScript, TypeScript, etc.)
NOTES FOR ALL PATTERNS IN THIS SCRIPT:
regex
library, not Python's built-in-crapSingle Line
(regex101) or regex.DOTALL
(Python regex) flagMatches:
<style> any code here </style>
blocks that aren't preceded by ```css + any amount of optional whitespacepunctuation
from the string library)<font color=red>NOTE</font>: Does not require regex.DOTALL
(?<!```css\s*)(\<style\>[\sa-z0-9\-\.\[\{\]\}:;#]+\<\/style\>)
(?<!```css\s*)(<style>.*?<\/style>)
(?<!```css\s*)(<style>.*?<\/style>)
Matches:
<!DOCTYPE html> any code here </html>
(?<!```html\s*)(<!DOCTYPE html>.*?<\/html>)
Matches:
<link href=>
up to, but not including, an empty line (?<!```html\s*)(<link href=.*?)(?=^\s*$)