Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>use strict; use warnings; while (&lt;DATA&gt;) { while (m#/(\*?)(.*?)\1/#g) { print "$2\n"; } } __DATA__ There are many who dare not kill themselves for [/fear/] of what the neighbors will say. Advice is what we ask for when we already know the /* answer */ but wish we didn’t. </code></pre> <p>As a one-liner:</p> <pre><code>perl -nlwe 'while (m#/(\*?)(.*?)\1/#g) { print $2 }' input.txt </code></pre> <p>The inner while loop will iterate between all matches with the <code>/g</code> modifier. The backreference <code>\1</code> will make sure we only match identical open/close tags.</p> <p>If you need to match blocks that extend over multiple lines, you need to slurp the input:</p> <pre><code>use strict; use warnings; $/ = undef; while (&lt;DATA&gt;) { while (m#/(\*?)(.*?)\1/#sg) { print "$2\n"; } } __DATA__ There are many who dare not kill themselves for [/fear/] of what the neighbors will say. /* foofer */ Advice is what we ask for when we already know the /* answer */ but wish we didn’t. foo bar / baz baaz / fooz </code></pre> <p>One-liner:</p> <pre><code>perl -0777 -nlwe 'while (m#/(\*?)(.*?)\1/#sg) { print $2 }' input.txt </code></pre> <p>The <code>-0777</code> switch and <code>$/ = undef</code> will cause file slurping, meaning all of the file is read into a scalar. I also added the <code>/s</code> modifier to allow the wildcard <code>.</code> to match newlines.</p> <p>Explanation for the regex: <code>m#/(\*?)(.*?)\1/#sg</code></p> <pre><code>m# # a simple m//, but with # as delimiter instead of slash /(\*?) # slash followed by optional * (.*?) # shortest possible string of wildcard characters \1/ # backref to optional *, followed by slash #sg # s modifier to make . match \n, and g modifier </code></pre> <p>The "magic" here is that the backreference requires a star <code>*</code> only when one is found before it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload