<?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[Please help me to replace text like the following condition]]></title><description><![CDATA[<p dir="auto">I have a text file like the folowing one:<br />
I want to replace text according to those conditions:</p>
<p dir="auto">if in the [FEN] string, there is a <strong>w</strong>, (case sensitive) then replace the uper [Result"*“] to [Result"1-0”]</p>
<p dir="auto">if in the [FEN] string, there is a <strong>b</strong> (case-sensitive) then replace the uper [Result"**“] to [Result"0-1”]</p>
<p dir="auto">Please help me, is there any way to this in notepad++<br />
Thank you.</p>
<ul>
<li>
<p dir="auto">[Event “”]<br />
[Site “”]<br />
[Date “???.??.??”]<br />
[Round “?”]<br />
[White “”]<br />
[Black “”]<br />
[Result “*”]<br />
[ECO “?”]<br />
[WhiteElo “0”]<br />
[BlackElo “0”]<br />
[Annotator “”]<br />
[Source “”]<br />
[Remark “P(100,12) +WR  1 1 1 10 ; 2 11 5 4 48 ; 3 9 39 @ 35WT”]<br />
[SetUp “1”]<br />
[FEN “2rbr2k/1pq2ppp/p3bn2/4p1B1/P3P3/2N3Q1/1PP1B1PP/3R1R1K w - - 0 1”]<br />
1.Rxd8!<br />
Qxd8 ( 1…Rcxd8 2.Rxf6! ) 2.Qh4! Bc4 3.Rxf6<br />
Bxe2 4.Rh6! f6 5.Bxf6 gxf6 6.Rxh7+<br />
Kg8 7.Qh6 Rc7 8.Qg6+ Kf8 9.Rh8+ Ke7 10.Nd5+<br />
{1:0, Lukin - Timoshchenko, corr, 1979}</p>
</li>
<li>
<p dir="auto">[Event “”]<br />
[Site “”]<br />
[Date “???.??.??”]<br />
[Round “?”]<br />
[White “”]<br />
[Black “”]<br />
[Result “*”]<br />
[ECO “?”]<br />
[WhiteElo “0”]<br />
[BlackElo “0”]<br />
[Annotator “”]<br />
[Source “”]<br />
[Remark “P +RU  1 1 1 10 ; 2 11 5 4 48 ; 3 9 39 @ 35WL”]<br />
[SetUp “1”]<br />
[FEN “3qr1k1/5ppp/4pn2/6B1/5RBQ/8/8/8 w - - 0 1”]<br />
1.Rxf6! gxf6 2.Bxf6 Qd5 3.Qh6</p>
</li>
<li>
<p dir="auto">[Event “”]<br />
[Site “”]<br />
[Date “???.??.??”]<br />
[Round “?”]<br />
[White “”]<br />
[Black “”]<br />
[Result “*”]<br />
[ECO “?”]<br />
[WhiteElo “0”]<br />
[BlackElo “0”]<br />
[Annotator “”]<br />
[Source “”]<br />
[Remark “P +RD  1 1 2 1 ; 2 - ; 3 - @ 766BL”]<br />
[SetUp “1”]<br />
[FEN “8/8/8/3q1r2/8/4R1Q1/4B1PP/7K b - - 0 1”]<br />
1…Qd1+ 2.Bxd1 Rf1#</p>
</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/topic/16283/please-help-me-to-replace-text-like-the-following-condition</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 21:46:50 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16283.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 06 Sep 2018 09:46:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Please help me to replace text like the following condition on Thu, 06 Sep 2018 16:08:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> said:</p>
<blockquote>
<p dir="auto">Replace All</p>
</blockquote>
<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> ,</p>
<p dir="auto">Thank you very much! It worked like <strong>magic</strong>!!! And your crystal cleared explaination make a dummy like me can get to understand. Surely, I need to start to learn about  regular expressions.</p>
<p dir="auto">Best Regards,<br />
Wanderoz</p>
]]></description><link>https://community.notepad-plus-plus.org/post/34675</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/34675</guid><dc:creator><![CDATA[Nguyen Wanderoz]]></dc:creator><pubDate>Thu, 06 Sep 2018 16:08:12 GMT</pubDate></item><item><title><![CDATA[Reply to Please help me to replace text like the following condition on Thu, 06 Sep 2018 22:40:54 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/nguyen-wanderoz" aria-label="Profile: nguyen-wanderoz">@<bdi>nguyen-wanderoz</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><strong>No</strong> problem with a search using <strong>regular expressions</strong> ! And, as you <strong>precisely</strong> explain you needs, it was very <strong>easy</strong> to built the <strong>right</strong> S/R :-)) So :</p>
<ul>
<li>
<p dir="auto">Open the <strong>Replace</strong> dialog ( <strong><code>Ctrl + H</code></strong> )</p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular expression</code></strong> search mode</p>
</li>
<li>
<p dir="auto">Tick the <strong><code>Wrap option</code></strong> option</p>
</li>
</ul>
<p dir="auto">SEARCH : <strong><code>(?s-i)(?&lt;=\[Result\x20")\*(?=.*?\[FEN\x20.*?\x20((w)|b)(\x20-){2})</code></strong></p>
<p dir="auto">REPLACE <strong><code>(?{2}1-0:0-1)</code></strong></p>
<ul>
<li>Click on the <strong><code>Replace All</code></strong> button, <strong>exclusively</strong> ( The <strong>step by step</strong> replacement, with the <strong><code>Replace</code></strong> button, does <strong>NOT</strong> work, because of the <strong>look-behind</strong> structure ! )</li>
</ul>
<p dir="auto">Et voilà !</p>
<hr />
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">First, note that the <strong><code>[</code></strong> symbol, ( as well as some others <strong><code>*</code></strong>, <strong><code>+</code></strong>, <strong><code>?</code></strong>, <strong><code>|</code></strong>, … …) is a <strong>special</strong> regex character and, thus, must be <strong>escaped</strong>, with the <strong><code>\</code></strong> symbol, to be taken <strong>literally</strong></p>
</li>
<li>
<p dir="auto">Note, also, that the <strong><code>\x20 </code></strong> syntax stands for a single <strong>space</strong> character. Of course, you may hit the <strong>space</strong> key, instead of writing <strong><code>\x20</code></strong>, in the <strong>Search what:</strong> zone</p>
</li>
<li>
<p dir="auto">As usual, at <strong>beginning</strong>, the <strong>modifiers</strong> <strong><code>(?s-i)</code></strong> means that :</p>
<ul>
<li>
<p dir="auto">The <strong>dot</strong> ( <strong><code>.</code></strong>  ) will match <strong>any single</strong> character, <strong>Standard</strong> or <strong>EOL</strong> one ( <strong><code>s</code></strong> )</p>
</li>
<li>
<p dir="auto">The search is performed in a <strong>sensitive</strong> way ( <strong><code>-i</code></strong> )</p>
</li>
</ul>
</li>
<li>
<p dir="auto">This regex, <strong>essentially</strong>, look for the <strong>star</strong> character ( <strong><code>\*</code></strong> ), of the zone <strong><code>[Result "*"]</code></strong>, but ONLY IF <strong>two</strong> conditions are <strong>TRUE</strong> :</p>
<ul>
<li>
<p dir="auto">It must be <strong>preceded</strong>, of course, with the string <strong><code>\[Result\x20"</code></strong>, due to the <strong>fix</strong>-length <strong>look-behind</strong>  <strong><code>(?&lt;=\[Result\x20")</code></strong></p>
</li>
<li>
<p dir="auto">It must be <strong>followed</strong> , due to <strong>look-ahead</strong> structure <strong><code>(?=.*?\[FEN\x20.*?\x20((w)|b)(\x20-){2})</code></strong>, by :</p>
<ul>
<li>
<p dir="auto">The <strong>shortest</strong> range of <strong>any</strong> character till the string <strong><code>\[FEN\x20</code></strong></p>
</li>
<li>
<p dir="auto">Then, <strong>followed</strong>, again, with the <strong>shortest</strong> range of <strong>any</strong> character till the string <strong><code>\x20((w)|b)(\x20-){2}</code></strong></p>
</li>
</ul>
</li>
</ul>
</li>
<li>
<p dir="auto">Before the <strong><code>\x20-\x20-</code></strong> string, it searches for the <strong>lower</strong>-case letter <strong><code>w</code></strong> or <strong><code>b</code></strong> ( group <strong><code>1</code></strong> ) and note that when case <strong><code>w</code></strong> happens, it is <strong>stored</strong> as <strong>group <code>2</code></strong> for <strong>later</strong> use in <strong>replacement</strong></p>
</li>
<li>
<p dir="auto">Now, due to the <strong>conditional</strong> replacement <strong><code>(?{2}1-0:0-1)</code></strong>, the search match ( the <strong><code>*</code></strong> char ) is, then, <strong>changed</strong> into :</p>
<ul>
<li>
<p dir="auto">The string <strong><code>1-0</code></strong> if <strong>group <code>2</code></strong> exists ( case <strong><code>w</code></strong> )</p>
</li>
<li>
<p dir="auto">The string <strong><code>0-1</code></strong> if <strong>group <code>2</code></strong> does <strong>not</strong> exist ( case <strong><code>b</code></strong> )</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/34666</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/34666</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 06 Sep 2018 22:40:54 GMT</pubDate></item></channel></rss>