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'(class=".*?")
I had to use this to do a global find/replace all within many files to reformat things like:
{{this}}to
{{ this }}Using gnu-sed instead of OS X sed because of compatability issues using -i with Mac version of sed. (brew install gnu-sed)
find . -type f -name '*.njk' | while read file;
do
gsed -i 's/{{\(\S\)/{{ \1/g' $file;
gsed -i 's/\(\S\)}}/\1 }}/g' $file;
done
Note that "Extract the content from inside an HTML tag with sed and a regex" just works if there is only one tag. In this case it works, but if you try to apply for other tags that can occur multiple times, you will not get the expected result.