<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Regex: Find html tags that only contain numbers]]></title><description><![CDATA[<p dir="auto">3 cases:</p>
<p dir="auto"><code>&lt;p&gt;My love is you&lt;/p&gt;</code><br />
<code>&lt;p&gt;2 5 x 7&lt;/p&gt;</code><br />
<code>&lt;p&gt;Love is me  5675&lt;/p&gt;</code></p>
<p dir="auto">I need to find a regex as to find all html tags that only contain numbers.</p>
<p dir="auto">The output find should be only: <code>&lt;p&gt;2 5 x 7&lt;/p&gt;</code></p>
<p dir="auto">My 2 regex expressions are almost good, but not good. Maybe someone give me a little help.</p>
<p dir="auto"><strong>FIND:</strong> <code>&lt;.*(\d+.*)&lt;/p&gt;</code><br />
or<br />
<strong><strong>FIND:</strong></strong> <code>&lt;.*(\d+.*)(?!\w+)&lt;/p&gt;</code></p>
]]></description><link>https://community.notepad-plus-plus.org/topic/25236/regex-find-html-tags-that-only-contain-numbers</link><generator>RSS for Node</generator><lastBuildDate>Tue, 08 Sep 2026 03:08:19 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/25236.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Dec 2023 14:58:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Regex: Find html tags that only contain numbers on Wed, 13 Dec 2023 08:01:51 GMT]]></title><description><![CDATA[<p dir="auto">I believe I find the solution:</p>
<p dir="auto"><strong>FIND:</strong>  <code>&lt;[^&gt;]*&gt;(\d+(\.\d+)?(\s*\w*)*)&lt;\/[^&gt;]*&gt;</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/91191</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91191</guid><dc:creator><![CDATA[Hellena Crainicu]]></dc:creator><pubDate>Wed, 13 Dec 2023 08:01:51 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Find html tags that only contain numbers on Tue, 12 Dec 2023 18:24:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hellena-crainicu" aria-label="Profile: Hellena-Crainicu">@<bdi>Hellena-Crainicu</bdi></a> said in <a href="/post/91161">Regex: Find html tags that only contain numbers</a>:</p>
<blockquote>
<p dir="auto">&lt;p&gt;2 5 x 7&lt;/p&gt;</p>
</blockquote>
<p dir="auto">That contains both spaces and the letter <code>x</code> and thus is <strong>not</strong> something that only contain numbers.</p>
<p dir="auto">An expression that only matches one or more numbers separated by white space would be something like <code>(\s*\d)+\s*</code></p>
<ul>
<li><code>(\s*\d)+</code> Allow for zero or more leading spaces followed by a decimal digit. The <code>+</code> lets the group repeat one or more times.  This allows for a one single digit number on up to any number-of-digit numbers separated by any number or spaces.</li>
<li><code>\s*</code> Allow for zero or more trailing spaces</li>
</ul>
<p dir="auto">That expression may have issues as <code>\s</code> is fairly liberal in what it accepts as a “space.” For example, it accepts Unicode no-break spaces, thin spaces, Ogham space marks, the Mongolian vowel separator, etc. A more restricted “space” may just be a plain <code>\x20</code>. You need decide what you accept as “space.”</p>
<p dir="auto">If you want to support the letter “x” as a “number” then that is easy to add, if you can carefully define the rules for when “x” as a number is allowed. For example, is <code>x</code> by itself a number or not?  Are <code>x x</code> and <code>xx</code> numbers or not?</p>
<p dir="auto">I ignored the “HTML tags” part of the original message as HTML tags are irregular text that is next to impossible, and perhaps impossible, to fully parse using regular expressions. You can chose to define a limited set of things that are HTML tags that can be matched via regular expressions.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91168</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91168</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Tue, 12 Dec 2023 18:24:34 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Find html tags that only contain numbers on Tue, 12 Dec 2023 15:38:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hellena-crainicu" aria-label="Profile: Hellena-Crainicu">@<bdi>Hellena-Crainicu</bdi></a><br />
The title of this topic is inconsistent with the request in your first post. You say that you want to “find html tags that contain only numbers” and say you want to find only <code>&lt;p&gt;2 5 x 7&lt;/p&gt;</code> in</p>
<pre><code>&lt;p&gt;My love is you&lt;/p&gt;
&lt;p&gt;2 5 x 7&lt;/p&gt;
&lt;p&gt;Love is me 5675&lt;/p&gt;
</code></pre>
<p dir="auto"><strong>but there is an additional match that you don’t want (<code>&lt;p&gt;Love is me 5675&lt;/p&gt;</code>) and unless you tell us why you don’t want it, we won’t be able to properly help you.</strong></p>
]]></description><link>https://community.notepad-plus-plus.org/post/91162</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91162</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Tue, 12 Dec 2023 15:38:57 GMT</pubDate></item></channel></rss>