By default grep doesn’t support non-greedy modifiers, you need to use the perl syntax: grep -P
.
greedy match
echo "<html><p>This</p><p>is</p><p>some</p><p>content</p></html>" | grep -E "<p>.+</p>" -o
<p>This</p><p>is</p><p>some</p><p>content</p>
non-greedy match
echo "<html><p>This</p><p>is</p><p>some</p><p>content</p></html>" | grep -P "<p>.+?</p>" -o
<p>This</p>
<p>is</p>
<p>some</p>
<p>content</p>