Skip to main content
peanball.net
  1. Tags/

Shell

2022


Outputting only the match / capturing group with grep Reading List

<time datetime="2022-05-26 09:22:12 &#43;0200 &#43;0200">26 May 2022</time><span class="px-2 text-primary-500">&middot;</span><span>26 words</span><span class="px-2 text-primary-500">&middot;</span><span title="Reading time">1 min</span>

Grep doesn’t handle capturing groups, but with lookaround you can match and exclude prefixes. This leaves you with the part of the pattern that you needed.