<?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: Replace tag with another tag from text]]></title><description><![CDATA[<p dir="auto">hello and happy new year. Maybe you can help me. I need to replace a tag with another tag.</p>
<p dir="auto"><code>&lt;p&gt;&lt;span class="my_home"&gt;My text here.&lt;/span&gt;&lt;/p&gt;</code></p>
<p dir="auto">should become:</p>
<p dir="auto"><code>&lt;p class="my_home"&gt;My text here.&lt;/p&gt;</code></p>
<p dir="auto">Can anyone help me?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/18719/regex-replace-tag-with-another-tag-from-text</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 09:06:20 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/18719.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Jan 2020 12:15:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Regex: Replace tag with another tag from text on Mon, 06 Jan 2020 16:45:57 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">thank you very much</p>
</blockquote>
<p dir="auto">You are welcome</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49684</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49684</guid><dc:creator><![CDATA[hasan123]]></dc:creator><pubDate>Mon, 06 Jan 2020 16:45:57 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Replace tag with another tag from text on Mon, 06 Jan 2020 16:31:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/17415">@hasan123</a> said in <a href="/post/49678">Regex: Replace tag with another tag from text</a>:</p>
<blockquote>
<p dir="auto">&lt;p $1&gt;$2&lt;/p&gt;</p>
</blockquote>
<p dir="auto">thank you very much</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49679</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49679</guid><dc:creator><![CDATA[Robin Cruise]]></dc:creator><pubDate>Mon, 06 Jan 2020 16:31:24 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Replace tag with another tag from text on Mon, 06 Jan 2020 16:21:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7753">@Robin-Cruise</a> said in <a href="/post/49673">Regex: Replace tag with another tag from text</a>:</p>
<blockquote>
<p dir="auto">ut in my case, it must be replace only that particular tag</p>
</blockquote>
<p dir="auto">Hello, for that case you may try with:</p>
<ul>
<li>FIND = <code>(?s)&lt;p&gt;&lt;span (.*?class="my_home".*?)&gt;(.*?)&lt;/span&gt;&lt;/p&gt;</code></li>
<li>REPLACE = <code>&lt;p $1&gt;$2&lt;/p&gt;</code></li>
<li>MODE = regular expression</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/49678</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49678</guid><dc:creator><![CDATA[hasan123]]></dc:creator><pubDate>Mon, 06 Jan 2020 16:21:30 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Replace tag with another tag from text on Mon, 06 Jan 2020 15:05:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> said in <a href="/post/49669">Regex: Replace tag with another tag from text</a>:</p>
<blockquote>
<p dir="auto">(?s)&lt;p&gt;&lt;span (.<em>?class=".</em>?".<em>?)&gt;(.</em>?)&lt;/span&gt;&lt;/p&gt;</p>
</blockquote>
<p dir="auto">yes, is good your solution. Thank you.</p>
<p dir="auto">But in my case, it must be replace only that particular tag <code>&lt;span class="my_home"&gt;</code>  :) How can be done ?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49673</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49673</guid><dc:creator><![CDATA[Robin Cruise]]></dc:creator><pubDate>Mon, 06 Jan 2020 15:05:18 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Replace tag with another tag from text on Mon, 06 Jan 2020 14:20:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7753">@Robin-Cruise</a> said in <a href="/post/49655">Regex: Replace tag with another tag from text</a>:</p>
<blockquote>
<p dir="auto">Can anyone help me?</p>
</blockquote>
<p dir="auto">Thank you before and after.  I have expanded the example mildly:</p>
<pre><code>&lt;p&gt;&lt;span class="my_home"&gt;My text here.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="other_class"&gt;Other text
there.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;No span here&lt;/p&gt;
&lt;p&gt;&lt;abbr title="Hope This Helps"&gt;HTH&lt;/abbr&gt;&lt;/p&gt;
</code></pre>
<ul>
<li>FIND = <code>(?s)&lt;p&gt;&lt;span (.*?class=".*?".*?)&gt;(.*?)&lt;/span&gt;&lt;/p&gt;</code></li>
<li>REPLACE = <code>&lt;p $1&gt;$2&lt;/p&gt;</code></li>
<li>MODE = regular expression</li>
</ul>
<pre><code>&lt;p class="my_home"&gt;My text here.&lt;/p&gt;
&lt;p class="other_class"&gt;Other text
there.&lt;/p&gt;
&lt;p&gt;No span here&lt;/p&gt;
&lt;p&gt;&lt;abbr title="Hope This Helps"&gt;HTH&lt;/abbr&gt;&lt;/p&gt;
</code></pre>
<p dir="auto">So my solution will change any class of <code>&lt;p&gt;&lt;span class="..."&gt;...&lt;/span&gt;&lt;/p&gt;</code>, but other similar constructs (without a span) will not change.  I made sure it would work even for multi-line paragraphs (again, not in your spec, but that’s a reasonable assumption in HTML paragraphs).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49669</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49669</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 06 Jan 2020 14:20:34 GMT</pubDate></item></channel></rss>