<?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[Remove special characters in certain location in csv file]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I have occurrence of a string that includes a special character that need to be removed.<br />
Example:<br />
“file://^598C372F08F75D25BA1D48522405CE21918E93A4D6475FC22E^pimgpsh_thumbnail_win_distr.jpg”<br />
in this example i need to remove the ^ character</p>
<p dir="auto">Please advise<br />
Thanks</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/14099/remove-special-characters-in-certain-location-in-csv-file</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 13:57:22 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/14099.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Jul 2017 08:16:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Remove special characters in certain location in csv file on Sun, 09 Jul 2017 17:16:19 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: claudia-frank">@<bdi>claudia-frank</bdi></a>,</p>
<p dir="auto">In other words, considering the <strong>general</strong> case, we have to search for <strong><code>C</code></strong> text, between <strong>two</strong> limits <strong><code>A</code></strong> and <strong><code>B</code></strong></p>
<p dir="auto">But, how to <strong>define</strong> text, which is between these <strong>two</strong> limits ? Well, simply, because, at <strong>ANY</strong> location reached :</p>
<ul>
<li>
<p dir="auto">A limit <strong><code>A</code></strong> must <strong>not</strong> be found, further on, in the <strong>same</strong> line</p>
</li>
<li>
<p dir="auto">A limit <strong><code>B</code></strong> <strong>must</strong> be found, further on, in the <strong>same</strong> line</p>
</li>
</ul>
<p dir="auto">This implies the <strong>two</strong> conditions to <strong>respect</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong>negative</strong> look-ahead <strong><code>(?!.*?A)</code></strong></p>
</li>
<li>
<p dir="auto">The <strong>positive</strong> look-ahead <strong><code>(?=.+?B)</code></strong></p>
</li>
</ul>
<p dir="auto">In our <strong>particular</strong> case :</p>
<ul>
<li>
<p dir="auto">Limit <strong><code>A</code></strong> is the string <strong>"file:\x2F\x2F</strong>  ( <strong><code>\x2F</code></strong> represents the normal <strong>slash</strong> character, <strong><code>/</code></strong> )</p>
</li>
<li>
<p dir="auto">Limit <strong><code>B</code></strong> is the simple ending <strong><code>"</code></strong> character</p>
</li>
<li>
<p dir="auto">And, of course, <strong><code>C</code></strong> is the regex to get <strong>special</strong> characters <strong><code>[^\w:/.]</code></strong></p>
</li>
</ul>
<p dir="auto">Just notice that we could <strong>swap</strong> the <strong>two</strong> lookarounds, without any problem ! Remember that, at <strong>any</strong> location, reached by the regex engine, the <strong>two</strong> conditions, resulting of the <strong>look-arounds</strong>, are, necessarily, both, <strong>evaluated</strong> !</p>
<p dir="auto">Thus, the complete search regex <strong><code>(?-is)(?=.+?")(?!.*?"file:\x2F\x2F)[^\w:/.]</code></strong>, correctly, find the <strong>same special</strong> characters, as in my <strong>previous</strong> post !</p>
<hr />
<p dir="auto">Now, using the <strong>example</strong> text, below :</p>
<pre><code class="language-diff">A sim^ple tes#t "file://^598C308F;75D2A1D485#22405CE21918@E94D6475FC22E^pimgpsh_thumbnail_win_distr.jpg" A si;mple Te@st
</code></pre>
<ul>
<li>
<p dir="auto">As long as the current regex engine location is <strong>before</strong> the string <strong>"file:…</strong>, the negative look-ahead <strong><code>(?!.*?"file:\x2F\x2F)</code></strong> is <strong>not</strong> true, so <strong>no overall</strong> match is possible, whatever the text <strong><code>C</code></strong> searched</p>
</li>
<li>
<p dir="auto">As soon as the current regex engine location is at the ending <strong><code>"</code></strong> double quote, or further on, the positive look-ahead <strong><code>(?=.+?")</code></strong> is <strong>false</strong>, so <strong>no overall</strong> match is possible, too, whatever the text <strong><code>C</code></strong> searched</p>
</li>
<li>
<p dir="auto">But, when the current regex engine location is, <strong>BOTH</strong>, right after the <strong>"file:…</strong> string AND before the <strong>ending</strong> <strong><code>"</code></strong> double quote, the <strong>two</strong> conditions are, <strong>simultaneously</strong>, TRUE. So, an <strong>overall</strong> match may be found, providing it, also, matches the <strong><code>C</code></strong> text. That is to say, the regex <strong><code>[^\w:/.]</code></strong></p>
</li>
</ul>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">Note that when the current regex engine location is <strong>right after</strong> the <strong>starting</strong> double quote, the <strong>negative</strong> look-ahead <strong><code>(?!.*?"file:\x2F\x2F)</code></strong>, this time, is <strong>true</strong>. So, we need to include the <strong>semicolon</strong> and the <strong>slash</strong>, as <strong>regular</strong> characters. Otherwise, they would be found and deleted, as well as the <strong>dot</strong> character !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25484</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25484</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 09 Jul 2017 17:16:19 GMT</pubDate></item><item><title><![CDATA[Reply to Remove special characters in certain location in csv file on Sun, 09 Jul 2017 16:05:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/itamar-ben-sinai" aria-label="Profile: Itamar-Ben-Sinai">@<bdi>Itamar-Ben-Sinai</bdi></a><br />
Of course this</p>
<blockquote>
<p dir="auto">you don’t do anything woring.</p>
</blockquote>
<p dir="auto">must be</p>
<p dir="auto"><strong>you don’t do anything wrong.</strong></p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25482</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25482</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sun, 09 Jul 2017 16:05:01 GMT</pubDate></item><item><title><![CDATA[Reply to Remove special characters in certain location in csv file on Sun, 09 Jul 2017 14:58:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/itamar-ben-sinai" aria-label="Profile: Itamar-Ben-Sinai">@<bdi>Itamar-Ben-Sinai</bdi></a></p>
<p dir="auto">you don’t do anything woring.<br />
My regex builds 3 capture groups which are<br />
internally reflected by the variables \1, \2 and \3.<br />
\1 contains what is discovered by (“file://.*?)<br />
\2 contains ([^~[])<br />
and  \3 what matched against (.*?”)</p>
<p dir="auto">Because the <strong>replace with</strong> contains only \1 and \3 the special chars,<br />
which are hold by \2, aren’t used.</p>
<p dir="auto">But I would recommend you use the solution provided by <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> as<br />
his way replaces the special chars directly in on go (Nice job Guy!!).</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a><br />
Your combination of a negative and positive lookahead revealed that I misunderstood<br />
the meaning as I was under the impression that it must be used within the “context” (?) of the text.<br />
Meaning, if we have a text like</p>
<pre><code>text_for_lookahead_match  followed_by_text_of_interest followed_by_aonther_lookahead_text
</code></pre>
<p dir="auto">I thought I need something like</p>
<pre><code>(?!whatever)(text_of_interest)(?=another_lookahead)
</code></pre>
<p dir="auto">but your solution</p>
<pre><code>(?!whatever)(?=another_lookahead)(text_of_interest)
</code></pre>
<p dir="auto">does it - GREAT - Learned something new :-)</p>
<p dir="auto">Thank you!!!</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25480</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25480</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sun, 09 Jul 2017 14:58:55 GMT</pubDate></item><item><title><![CDATA[Reply to Remove special characters in certain location in csv file on Sun, 09 Jul 2017 13:06:04 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/itamar-ben-sinai" aria-label="Profile: itamar-ben-sinai">@<bdi>itamar-ben-sinai</bdi></a>,</p>
<p dir="auto">Am I understanding you correctly ?</p>
<p dir="auto">You would like to <strong>delete</strong> any <strong>special</strong> character, which lies, <strong>exclusively</strong>, in a <strong>one-line</strong> range of characters, between an <strong>initial</strong> <strong><code>"file://"</code></strong> string and an <strong>ending</strong> <strong><code>"</code></strong> character, wouldn’t you ?</p>
<p dir="auto">I suppose that <strong>letters</strong>, <strong>digits</strong> and the <strong>underscore</strong> character ( <strong><code>_</code></strong> ) are considered as <strong>regular</strong> characters, which should <strong>NOT</strong> be <strong>deleted</strong>. If I include, the <strong>semicolon</strong> ( <strong><code>:</code></strong> ), the <strong>slash</strong> ( <strong><code>/</code></strong> ) and the <strong>dot</strong> ( <strong><code>.</code></strong> ) symbols, as <strong>regular</strong> characters, this means that any single <strong>special</strong> character could be found with the <strong>negative character class</strong> <strong><code>[^\w:/.]</code></strong>, where <strong><code>\w</code></strong> stands for any <strong>Word</strong> character</p>
<hr />
<p dir="auto">Therefore, a correct regex <strong>S/R</strong> could be :</p>
<p dir="auto">SEARCH <strong><code>(?-is)(?!.*?"file:\x2F\x2F)(?=.+?")[^\w:/.]</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY !</code></strong></p>
<p dir="auto">For instance, in the text, below, all the <strong>underlined</strong> characters would be <strong>deleted</strong>, after a click on the <strong>Replace All</strong> button</p>
<p dir="auto">Just note that <strong>special</strong> characters, located <strong>before</strong> the <strong><code>"file:</code></strong> string OR <strong>after</strong> the ending <strong><code>"</code></strong> are correctly <strong>untouched</strong> !</p>
<p dir="auto">This regex performs a <strong>one-line</strong> search, in a <strong>case-sensitive</strong> way</p>
<pre><code class="language-diff">A sim^ple tes#t "file://^598C308F;75D2A1D485#22405CE21918@E94D6475FC22E^pimgpsh_thumbnail_win_distr.jpg" A si;mple Te@st
                        ¯        ¯          ¯            ¯             ¯
						
A sim^ple tes#t "file://98C+308F75D251D485?22405CE2&lt;1918E93D6&gt;475FC22Epimgpsh_thumb~nail_win_dis&amp;tr.jpg" &lt;A&gt; si;mple Te@st
                           ¯              ¯        ¯         ¯                     ¯            ¯
</code></pre>
<p dir="auto"><strong>Remarks</strong> :</p>
<ul>
<li>
<p dir="auto">If the <strong><code>^</code></strong> character must be considered as a <strong>regular</strong> character, change the <strong>ending</strong> part of the search regex by <strong><code>[^\w:/.^]</code></strong></p>
</li>
<li>
<p dir="auto">If the <strong><code>\</code></strong> character must be considered as a <strong>regular</strong> character, change the <strong>ending</strong> part of the search regex by <strong><code>[^\w:/.\\]</code></strong></p>
</li>
<li>
<p dir="auto">If the <strong><code>]</code></strong> character must be considered as a <strong>regular</strong> character, change the <strong>ending</strong> part of the search regex by <strong><code>[^]\w:/.]</code></strong></p>
</li>
<li>
<p dir="auto">If the <strong><code>-</code></strong> character must be considered as a <strong>regular</strong> character, change the <strong>ending</strong> part of the search regex by <strong><code>[^\w:/.-]</code></strong></p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25475</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25475</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 09 Jul 2017 13:06:04 GMT</pubDate></item><item><title><![CDATA[Reply to Remove special characters in certain location in csv file on Sun, 09 Jul 2017 07:03:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a><br />
Hi,<br />
When searching with (“file://.<em>?)(.</em>?”) I find the exact entry that starts with file:// and ends with (")<br />
When i insert the search for special characters in between  (“file://.<em>?) and (.</em>?”), the search marks the line from first occurrence of file:// to the end of the line.<br />
What am I doing wrong?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25470</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25470</guid><dc:creator><![CDATA[Itamar Ben-Sinai]]></dc:creator><pubDate>Sun, 09 Jul 2017 07:03:24 GMT</pubDate></item><item><title><![CDATA[Reply to Remove special characters in certain location in csv file on Sat, 08 Jul 2017 21:16:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/itamar-ben-sinai" aria-label="Profile: Itamar-Ben-Sinai">@<bdi>Itamar-Ben-Sinai</bdi></a></p>
<p dir="auto">the following solution would need multiple <strong>replace all</strong> as it would find/replace one occurrence per time only.</p>
<pre><code>find what:("file://.*?)([\^~\[])(.*?")
replace with:\1\3
</code></pre>
<p dir="auto">The second capture group is the interesting part as it defines the chars you do not want to have within an alternation (starts with [ and ends with ]).<br />
Currently 3 chars are defined, ^ ~  and [.<br />
^ needs to be escaped as it is a special char within regex, as well as [<br />
So if you do not want to have, let’s say a semicolon in addition you would use</p>
<pre><code>("file://.*?)([\^~\[;])(.*?")
</code></pre>
<p dir="auto">or if only ^ and semicolon should be replaced</p>
<pre><code>("file://.*?)([\^;])(.*?")
</code></pre>
<p dir="auto">Make sure you’ve backed up the data in case anything goes wrong.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25463</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25463</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sat, 08 Jul 2017 21:16:34 GMT</pubDate></item><item><title><![CDATA[Reply to Remove special characters in certain location in csv file on Sat, 08 Jul 2017 18:04:30 GMT]]></title><description><![CDATA[<p dir="auto">not ignorance, I guess I did not explain myself well<br />
I have about 300 occurancs of string like in the example, that have different special characters, that may be located in different parts of the string, so I need to remove all of these special characters that only appear after the beginning of the “file://” string and before the closing of the csv section(") where "file:// is located</p>
<p dir="auto">Thanks</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25460</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25460</guid><dc:creator><![CDATA[Itamar Ben-Sinai]]></dc:creator><pubDate>Sat, 08 Jul 2017 18:04:30 GMT</pubDate></item><item><title><![CDATA[Reply to Remove special characters in certain location in csv file on Fri, 07 Jul 2017 11:43:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/itamar-ben-sinai" aria-label="Profile: Itamar-Ben-Sinai">@<bdi>Itamar-Ben-Sinai</bdi></a></p>
<p dir="auto">Ignore my ignorance but why not simply use find/replace dialog?</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25440</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25440</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Fri, 07 Jul 2017 11:43:55 GMT</pubDate></item><item><title><![CDATA[Reply to Remove special characters in certain location in csv file on Fri, 07 Jul 2017 08:42:44 GMT]]></title><description><![CDATA[<p dir="auto">Note: the string may include other special characters, in different positions<br />
Thanks</p>
]]></description><link>https://community.notepad-plus-plus.org/post/25437</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/25437</guid><dc:creator><![CDATA[Itamar Ben-Sinai]]></dc:creator><pubDate>Fri, 07 Jul 2017 08:42:44 GMT</pubDate></item></channel></rss>