Note that there are some explanatory texts on larger screens.

plurals
  1. POHOWTO: compose REGEXP to match <li> with certain class attr
    primarykey
    data
    text
    <p>I need to catch the following tags + content in html source of the page:</p> <pre><code>&lt;li class="someClass someClass2"&gt; ... some html code ... &lt;/li&gt; </code></pre> <p>I'm not very good at regular expressions, so I'll also appreciate comments containing links to a good tutorial. I've been checking <a href="http://www.regular-expressions.info/" rel="nofollow">http://www.regular-expressions.info/</a> out, but I'm not very happy with explanations there.</p> <p>What I found on the above site was smt like this:</p> <pre><code>&lt;li\b[^&gt;]*&gt;(.*?)&lt;/li&gt; </code></pre> <p>This matches all the <code>&lt;li&gt;</code> tags, which is not what I want. I tried messing around with it, and tested this one</p> <pre><code>&lt;li class="someClass someClass[1-9]{1,1}[0-9]*"&gt;(.*?)&lt;/li&gt; </code></pre> <p>Unfortunately, this one doesn't do the job as well. The second class name is in format <em>someClassX</em>, where X is from {1, 2, ... } (well, obviously, it's not a set of natural numbers :) )</p> <p><strong>All I get from this regexp is "no matches". I'm using Ubuntu, Kodos tool.</strong></p> <p>What's even more depressing is the fact that this regexp: </p> <pre><code>&lt;li class="someClass someClass[1-9]{1,1}[0-9]*"&gt; </code></pre> <p>actually catches the opening <code>&lt;li&gt;</code> tags, but nothing more, just as if it gets "distracted" by new line character.</p> <p>I'm still looking for a solution on google, and I'll post it here if found, but I would also really appreciate some helpful input :)</p> <p>Thx</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.
 

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