Skip to content

Instantly share code, notes, and snippets.

View JeremiahK96's full-sized avatar

Jeremiah Knol JeremiahK96

View GitHub Profile
@daveydee33
daveydee33 / regex-and-sed-things.md
Last active May 8, 2025 11:47
Extract an HTML tag value using sed with regular expression

Extract the content from inside an HTML tag with sed and a regex

example <title>this is it</title> if we want to extract just this is it.

echo '<title>this is it</title>' | sed -nE 's/<title>(.*)<\/title>/\1/p'

Regex Find and select HTML attributes - such as a "class" name, even if it spans multiple lines.