<?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[Finding multiple words inside extra quotes]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I’m using this string to find an incorrectly quoted single word inside of a set of double quote text qualifiers and comma delimiters.</p>
<p dir="auto">(,“[^”]<em>)("\w</em>)(“)([^”]*",)</p>
<p dir="auto">Finds<br />
,“123 Main St Apt “D””,</p>
<p dir="auto">What modification do I need to make to find multiple words(and possible numbers) like example below?</p>
<p dir="auto">,“123 Main “St Apt D””,</p>
<p dir="auto">Thank you in advance for the help!</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20644/finding-multiple-words-inside-extra-quotes</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Jul 2026 12:50:27 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20644.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 27 Jan 2021 17:44:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Sat, 30 Jan 2021 19:36:35 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> This solution is perfect and returns all the errors I am looking for. Thank you!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62342</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62342</guid><dc:creator><![CDATA[TexasKCFan]]></dc:creator><pubDate>Sat, 30 Jan 2021 19:36:35 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Sat, 30 Jan 2021 20:45:38 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: texaskcfan">@<bdi>texaskcfan</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">While searching a <strong>solution</strong>, I realized that the <strong>comma</strong> delimiter can also be found <strong>inside</strong> fields themselves ! This is really <strong>problematic</strong> :(</p>
<p dir="auto">So, in order to get a neat <strong>field delimiter</strong>, we should, <strong>temporarily</strong>, change the <strong><code>,</code></strong> <strong>delimeter</strong> by, let’s say, the <strong><code>¤</code></strong> character if this char is <strong>not</strong> used in your file ! From now on, I suppose that it’s the case :</p>
<p dir="auto">Thus, we <strong>first</strong> change the <strong>field delimiter</strong> of your file with the simple <strong>normal</strong> S/R :</p>
<p dir="auto">SEARCH <strong><code>","</code></strong></p>
<p dir="auto">REPLACE <strong><code>"¤"</code></strong></p>
<p dir="auto">Note that you may replace the <strong><code>¤</code></strong> char with <strong>any</strong> char <strong>not</strong> used <strong>yet</strong> !</p>
<p dir="auto">And, at the <strong>very end</strong> of the process, you’ll just perform this <strong>normal</strong> S/R to get the <strong>right</strong> syntax, again :</p>
<p dir="auto">SEARCH <strong><code>¤</code></strong></p>
<p dir="auto">REPLACE <strong><code>,</code></strong></p>
<hr />
<p dir="auto">Now, given your <strong><code>3</code></strong> <strong>error</strong> cases that you provided, here is my <strong>first</strong> try towards a <strong>complete</strong> solution ! I’m using the <strong>free-spacing</strong> mode <strong><code>(?x)</code></strong> for a better <strong>readability</strong> !</p>
<ul>
<li>MARK <strong><code>(?x)  (?:^"|"¤")  \K  ([^"'¤\r\n]*?)  ("|')  (?1) \2?  (?1)  (?="¤"|"\R|"\z)</code></strong>    <strong>without</strong> the outer <strong><code>"</code></strong> chars <strong>marked</strong></li>
</ul>
<p dir="auto">OR</p>
<ul>
<li>MARK <strong><code>(?x)  (?:^|"¤)  \K " ([^"'¤\r\n]*?)  ("|')  (?1) \2?  (?1)  "  (?=¤"|\R|\z)</code></strong>    <strong>with</strong> the outer <strong><code>"</code></strong> chars <strong>marked</strong></li>
</ul>
<p dir="auto">If we try these <strong>two</strong> regexes, against this <strong>sample</strong> text, below :</p>
<pre><code class="language-z">"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"123 Main "St", Apt Q"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"123 "Main St, Apt Q""¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"123 Main S't, Apt Q"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"

"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"123 Main "St, Apt Q"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"123 Main St, Apt Q""¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"123 Main S't, A'pt Q"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"

"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
"123 "Main St, Apt Q""¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"123 Main "St", Apt Q"¤"Field_7"¤"Field_8"¤"Field_9"¤"123 Main S't, Apt Q"
"Field_1"¤"Field_2"¤"Field_3"¤"Field_4"¤"Field_5"¤"Field_6"¤"Field_7"¤"Field_8"¤"Field_9"¤"Field_10"
</code></pre>
<hr />
<p dir="auto">we get :</p>
<p dir="auto"><img src="/assets/uploads/files/1612002903696-54839a2e-04a5-4f1e-8635-68209f9cb2af-image.png" alt="54839a2e-04a5-4f1e-8635-68209f9cb2af-image.png" class=" img-fluid img-markdown" /></p>
<hr />
<ul>
<li>
<p dir="auto">In that <strong>sample</strong>, I simply consider lines of <strong><code>10</code></strong> <strong>fields</strong></p>
</li>
<li>
<p dir="auto">In lines <strong><code>4</code></strong>, <strong><code>7</code></strong> and <strong><code>10</code></strong>, you’ll recognize your <strong><code>3</code></strong> <strong>error</strong> cases</p>
</li>
<li>
<p dir="auto">In lines <strong><code>14</code></strong>, <strong><code>17</code></strong> and <strong><code>20</code></strong>, I <strong>deleted</strong> one <strong>double</strong> quote and <strong>added</strong> one <strong>single</strong> quote, which are also <strong>correctly</strong> detected as a possible <strong>error</strong> by the regex. But, If you do <strong>not</strong> need the detection of these <strong>extra</strong> cases, I won’t have any problem to <strong>modify</strong> the regex</p>
</li>
<li>
<p dir="auto">In line <strong><code>24</code></strong>, I added a record with the <strong><code>3</code></strong> <strong>error</strong> cases, together</p>
</li>
<li>
<p dir="auto">From lines <strong><code>29</code></strong> to <strong><code>50</code></strong>, results are <strong>identical</strong> to those above, but the <strong>outer double-quotes</strong>, containing fields, are also <strong>marked</strong> !</p>
</li>
</ul>
<hr />
<p dir="auto">In this text, it’s very <strong>easy</strong> to <strong>move</strong> from one <strong>error</strong>’s zone to an other one :</p>
<ul>
<li>
<p dir="auto">Use the <strong><code>F2</code></strong> and the <strong><code>Shift + F2</code></strong> shortcuts to move from one <strong>erroneous</strong> record to the <strong>next</strong> or <strong>previous</strong> one</p>
</li>
<li>
<p dir="auto">Use the <strong><code>Ctrl + 0</code></strong> and <strong><code>Ctrl + Shift + 0</code></strong> shortcuts, on the <strong>main</strong> keyboard, to move from one <strong>erroneous</strong> field to the <strong>next</strong> or <strong>previous</strong> one</p>
</li>
</ul>
<hr />
<p dir="auto">You’ll remark, that I haven’t spoken yet, about a method to <strong>isolate</strong> all the <strong>erroneous</strong> fields, <strong>one</strong> per line. Indeed, <a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: texaskcfan">@<bdi>texaskcfan</bdi></a>, I would like, first, to get your <strong>feeling</strong> about keeping records as they are ( excepted for the <strong>temporary</strong> field <strong>delimiter</strong> change ! ) and simply navigating between all <strong>error</strong>’s zones, with the <strong>shortcuts</strong> mentioned above !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62335</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62335</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 30 Jan 2021 20:45:38 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Sat, 30 Jan 2021 04:46:19 GMT]]></title><description><![CDATA[<p dir="auto">Hello,<a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: TexasKCFan">@<bdi>TexasKCFan</bdi></a><br />
Please try this code, To Finding multiple words inside extra quotes<br />
Regex:</p>
<pre><code>/^[^"]*("[^"]*"[^"]*)*"[^"]*search[^"]*"/i
</code></pre>
<p dir="auto">I hope this code will be useful to you.<br />
Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62333</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62333</guid><dc:creator><![CDATA[prahladmifour]]></dc:creator><pubDate>Sat, 30 Jan 2021 04:46:19 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Sat, 30 Jan 2021 00:28:34 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> My apologies for the confusion. Thank you for the general knowledge for the community!</p>
<ol>
<li>Given a single record of 8 fields, I would expect to see it exactly as you posted but minus the CRLF at the beginning and with an opening quote.</li>
</ol>
<p dir="auto"><code>"Field_1","Field_2","Field_3 with ERROR 1","Field_4","Field_5","Field_6 with ERROR 2","Field_7","Field_8"CRLF</code></p>
<ol start="2">
<li>Yes, I plan to isolate erroneous fields. What I meant to say is these would be the three different examples of errors I would be able to identify in my data. My sample text represented three versions of errors I would find in a single field. A full line would be 38 fields in the format just included above.</li>
</ol>
<pre><code>“123 Main “St”, Apt Q” - Example of a single word incorrectly encased in double quotes `"St"`
“123 “Main St, Apt Q”” - Example of a phrase incorrectly encased in double quotes `"Main St, Apt Q"`
“123 Main S’t, Apt Q” - Example of an incorrect single quote `S't`
</code></pre>
<ol start="3">
<li>Yes, my goal is to identify the errors so I can copy the rows and bring them to the client’s attention so the can fix them. I am not correcting the errors, simply identifying them during my pre-processing QA. If I process the files with these errors, the records will not load so I’m attempting to provide additional value to the client. :-)</li>
</ol>
<p dir="auto">I will be able to use the solutions above to identify the issues. I will put together a range of records for you to review and post later.</p>
<p dir="auto">Thank you so much for your help! :-))</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62326</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62326</guid><dc:creator><![CDATA[TexasKCFan]]></dc:creator><pubDate>Sat, 30 Jan 2021 00:28:34 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Mon, 31 May 2021 12:58:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: texaskcfan">@<bdi>texaskcfan</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Well, of course, my previous search is rather <strong>academic</strong> and <strong>not adapted</strong> to your <strong>own</strong> data. It just showed a way to search for an <strong>odd</strong> number of <strong>double quotes</strong> in fields defined as below :</p>
<ul>
<li>
<p dir="auto">A field begins <strong>after</strong> a double quote at <strong>beginning</strong> of line or <strong>after</strong> the string <strong><code>","</code></strong></p>
</li>
<li>
<p dir="auto">This <strong>same</strong> field ends <strong>before</strong> a next string <strong><code>","</code></strong> or <strong>before</strong> an <strong>end</strong> of line or the very <strong>end</strong> of current file</p>
</li>
</ul>
<p dir="auto">And my goal was to <strong>demonstrate</strong> that this kind of search can be achieved, <strong>only</strong> with <strong>recursive</strong> regexes. Indeed, if you <strong>lack</strong> this kind of regexes, you need to find out <strong>one</strong> regex which will match zones with <strong><code>1</code></strong> <strong>double quote</strong> <em>ONLY</em>, an <strong>other</strong> regex, which will match zones with <strong><code>3</code></strong> <strong>double quotes</strong> <em>ONLY</em>, and so on…</p>
<hr />
<p dir="auto">But, seemingly, it’s <strong>not</strong> exactly why you’re posting here !. However, I’m rather <strong>confused</strong> in some ways, by your <strong>last</strong> post  :</p>
<ul>
<li>When you say :</li>
</ul>
<blockquote>
<p dir="auto">I think the expected error output would be something like this:</p>
</blockquote>
<blockquote>
<p dir="auto">“123 Main “St”, Apt Q”<br />
“123 “Main St, Apt Q””<br />
“123 Main S’t, Apt Q”</p>
</blockquote>
<p dir="auto">Do you mean that, given a <strong>single</strong> record of <strong><code>8</code></strong> fields :</p>
<pre><code class="language-z">CRLFField_1","Field_2","Field_3 with ERROR 1","Field_4","Field_5","Field_6 with ERROR 2","Field_7","Field_8"CRLF
</code></pre>
<p dir="auto">You expect this <strong>output</strong> :</p>
<pre><code class="language-z">.... PREVIOUS record ....
"Field_1","Field_2"CRLF
"Field_3 with ERROR 1"CRLF
"Field_4","Field_5"CRLF
"Field_6 with ERROR 2"CRLF
"Field_7","Field_8"CRLF
.... NEXT record ....
</code></pre>
<p dir="auto">In other words do you plan to isolate <strong>erroneous</strong> fields ?</p>
<p dir="auto">Note that, at this time of the discussion, I don’t care about the <strong>errors</strong> themselves ! We’ll track them, later, by <strong>appropriate</strong> regexes !</p>
<ul>
<li>Secondly, does your <strong>sample</strong> text :</li>
</ul>
<pre><code class="language-diff">"123 Main "St", Apt Q"
"123 "Main St, Apt Q""
"123 Main S't, Apt Q"
</code></pre>
<p dir="auto">Represent <strong><code>3</code></strong> fields, <strong>one</strong> per line, delimited with the outer <strong><code>"</code></strong> characters ?</p>
<p dir="auto">Represent <strong>several</strong> fields per line. For instance, <strong><code>"123 "Main St, Apt Q""</code></strong> would have <strong>two</strong> fields <strong><code>123 "Main St</code></strong> and <strong><code> Apt Q"</code></strong>, separated with the <strong>comma</strong> ?</p>
<ul>
<li>
<p dir="auto">Thirdly, if we consider any field, with <strong>delimiter</strong> = <strong>beginning</strong> or <strong>end</strong> of line or the string <strong><code>","</code></strong>, can you show us the <strong>different</strong> types of strings, containing <strong>single</strong> and/or <strong>double</strong> quotes and/or commas, in between, which may occur and <strong>which</strong> are the ones that you would like to detect as <strong>errors</strong> ?</p>
</li>
<li>
<p dir="auto">More generally, which further <strong>treatment</strong> do you expect, when meeting these <strong>errors</strong> ?</p>
</li>
</ul>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: texaskcfan">@<bdi>texaskcfan</bdi></a>, it’s important to note that regexes are <strong>extremely sensitive</strong> to <strong>real</strong> data used and, although I give some <strong>generic</strong> regexes for <strong>general</strong> purposes, in this forum, a regular expression is generally adapted to a <strong>specific</strong> user and for <strong>specific</strong> data ;-))</p>
<hr />
<p dir="auto">I probably <strong>miss</strong> a lot of things about your data and your work-flow :-( So, just <strong>enlighten</strong> me !</p>
<p dir="auto">See you later,</p>
<p dir="auto">Best regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> : The best would be that you provides a <strong>part</strong> of your file, containing a <strong>fairly</strong> range of records, which <strong>identifies</strong> the zones to be detected as <strong>erroneous</strong> !</p>
<p dir="auto">Finally, if your data is rather <strong>confidential</strong>, just send me an e-mail at :</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62315</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62315</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 31 May 2021 12:58:51 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Fri, 29 Jan 2021 17:46:58 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> I can’t express how much I appreciate this additional detail! One search string to identify all inconsistencies would be a HUGE time saver. Since many of the files I work with have a couple of hundred thousand lines, my process is to identify the lines with issues, copy them and send them back to the client so they can correct them.</p>
<p dir="auto">One note on the structure of my data…a successful line is 38 fields in this structure:</p>
<pre><code>"Field 1", "Field 2","Field 3"CRLF
</code></pre>
<p dir="auto">Data wrapped in a set of double quotes is acceptable regardless of punctuation (a lot of foreign addresses have multiple periods and commas). The issues are caused by extra single or double quotes without the properly associated commas, incorrectly causing the fields to be misaligned. Either one word, or a group of words contains extra single or double quotes without the correctly placed comma creates extra fields. Single quotes can cause an also because the system’s looking for the non-existent matching quote.</p>
<pre><code>"Field "1"",
"Fiel'd 1",
"Field 1 "but with additional spaces and characters" and extra set of quotes",
</code></pre>
<p dir="auto">When I run <code>(?x) (?:^\h*|,) (?: ( " (?: [^"\r\n,]++ | (?1) )* " ) )+? (?=,|\R|\z) (*SKIP) (*F) | (?-s) .+? (?=,|\R|\z)</code> I see that I’m getting non-error results like:</p>
<pre><code>,"123 Main St, Apt Q"
</code></pre>
<p dir="auto">While this example is not <em>really</em> correct (Apt Q should be in the next field), it doesn’t cause an issue per se because the whole thing is correctly enclosed in one set of double quotes and there are no extra quotes.</p>
<p dir="auto">I think the expected error output would be something like this:</p>
<pre><code>"123 Main "St", Apt Q"
"123 "Main St, Apt Q""
"123 Main S't, Apt Q"
</code></pre>
<p dir="auto">If every line starts with an opening quote, ends with a closing quote, followed by CRLF and all the quotes in between have matching quote with a comma delimiter then I have the correct number of fields and my only concern is when they put the data in the wrong fields which is beyond the scope of this post. :)</p>
<p dir="auto">Is it possible to make the start and end of the search string double quotes instead of commas so we can identify extra quotes (single or double) that don’t belong?</p>
<p dir="auto">I’m brand new to the regex world and I truly appreciate the assistance!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62313</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62313</guid><dc:creator><![CDATA[TexasKCFan]]></dc:creator><pubDate>Fri, 29 Jan 2021 17:46:58 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Thu, 28 Jan 2021 17:08:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: texaskcfan">@<bdi>texaskcfan</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I <strong>improved</strong> my regex in order to satisfy <strong>all</strong> the possible cases and get a <strong>coherent</strong> behavior :</p>
<p dir="auto">MARK <strong><code>(?x)  (?:^\h*|,)  (?: (  "  (?:  [^"\r\n,]++  |  (?1)  )*  "  )  )+?   (?=,|\R|\z)  (*SKIP) (*F)  |  (?:^\h*|,)  (?: [^"\r\n]+  (?=,|\R|\z)  (*SKIP) (*F)  |  [^,\r\n]+?  (?=,|\R|\z) )</code></strong></p>
<p dir="auto">So, to summarize, this regex will mark, from <strong>beginning</strong> of line, any possible <strong>comma</strong> and its <strong>next</strong> zone, till the <strong>nearest</strong> comma, <strong>excluded</strong>, or till the <strong>end</strong> of line / file, <em>ONLY IF</em>  this zone contains an <strong>odd</strong> number of <strong>double quotes</strong> <strong><code>"</code></strong></p>
<p dir="auto">Just use this <strong>sample</strong>, below, to test the <strong>regex</strong> against !</p>
<pre><code class="language-z"># With 0, 1, 2, 3, 4, 5 or 6 DOUBLE quote(s) and WITHOUT any char between DOUBLE-quotes
#  =&gt; Matches when 1, 3 or 5 DOUBLE quote(s) ( INCORRECT zones ) :

,,
,",
,"",
,""",
,"""",
,""""",
,"""""",

# With 0, 1, 2, 3, 4, 5 or 6 DOUBLE quote(s) and with some WORD chars between DOUBLE-quotes
#  =&gt; Matches when 1, 3 or 5 DOUBLE quote(s) ( INCORRECT zones ) :
 
,,
,",
,"123456",
,"123"456",
,"12"34"56",
,"12"34"56"78",
,"12"34"56"78"90",

,ABCXYZ,
,"ABCXYZ,
,"ABCXYZ",
,"ABC"XYZ",
,"ABC""XYZ",
,"ABC"""XYZ",
,"ABC""""XYZ",

,ABCXYZ,
,ABCXYZ",
,"ABCXYZ",
,"ABC"XYZ",
,""ABCXYZ"",
,""ABC"XYZ"",
,"""ABCXYZ""",

# With an EVEN number of DOUBLE quotes ( 4 ) for the STARTING, MIDDLE and ENDING field of a record
#  =&gt; CORRECT zones, NOT matched :

"12"345678"90",
,"123"4567"890",
,"1234"56"7890"

# With an ODD number of DOUBLE quotes ( 3 ) for the STARTING, MIDDLE and ENDING field of a record
#  =&gt; INCORRECT zones, matched :

"12345"67890",
,"12345678"90",
,"12"34567890"

# WITHOUT any DOUBLE-quote =&gt; All are CORRECT zones, so NOT matched ( indeed ZERO is an EVEN number ! )

,
,,
ABCXYZ
ABCXYZ,
,ABCXYZ,
,ABCXYZ
</code></pre>
<hr />
<p dir="auto">And we get the <strong>picture</strong> :</p>
<p dir="auto"><img src="/assets/uploads/files/1611853669974-41b9daae-c76d-4a78-8e69-66e85aaa62a0-image.png" alt="41b9daae-c76d-4a78-8e69-66e85aaa62a0-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62273</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62273</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 28 Jan 2021 17:08:59 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Thu, 28 Jan 2021 13:11:06 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: texaskcfan">@<bdi>texaskcfan</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: Peterjones">@<bdi>Peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a> and <strong>All</strong>,</p>
<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">Note, also, that it’s <strong>impossible</strong> build up a regex in order to get the <strong>opposite</strong> logic, i.e. which would match the <strong>general</strong> case of any zone, between <strong>two commas</strong>, containing an <strong>odd</strong> number of <strong>double quotes</strong> inside !</p>
</blockquote>
<p dir="auto">Well… I was <strong>wrong</strong> :-( As usual , just when I woke up, I understood the way to do ! We simply must add the <strong>two control verbs</strong> sequence <strong><code>(*SKIP)(*F)</code></strong> at the <strong>end</strong> of the <strong>previous</strong> regex and add an <strong>alternative</strong> which selects all <strong>standard</strong> chars sequence till the <strong>nearest comma</strong> <strong><code>,</code></strong> character ;-)), giving the <strong>final</strong> regex :</p>
<p dir="auto">MARK <strong><code>(?x)  (?:^\h*|,)  (?: (  "  (?:  [^"\r\n,]++  |  (?1)  )*  "  )  )+?   (?=,|\R|\z)  (*SKIP) (*F)   |  (?-s)  .+?  (?=,|\R|\z)</code></strong></p>
<p dir="auto">With the <strong>same</strong> sample as in my <strong>previous</strong> post, we get, this time :</p>
<p dir="auto"><img src="/assets/uploads/files/1611834578168-0fccd582-5f14-4310-909c-5b8ac0dfc754-image.png" alt="0fccd582-5f14-4310-909c-5b8ac0dfc754-image.png" class=" img-fluid img-markdown" /></p>
<hr />
<p dir="auto">Now, it’s even more <strong>easy</strong> to focus our attention on the <strong>problem areas</strong> !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62256</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62256</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 28 Jan 2021 13:11:06 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Thu, 28 Jan 2021 04:56:01 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: texaskcfan">@<bdi>texaskcfan</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: Peterjones">@<bdi>Peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: texaskcfan">@<bdi>texaskcfan</bdi></a>, if I assume that :</p>
<ul>
<li>
<p dir="auto">Your list contains <strong>one</strong> record per <strong>line</strong></p>
</li>
<li>
<p dir="auto">The <strong>field</strong> separator is the <strong>comma</strong>, located <strong>right after</strong> the <strong>previous</strong> field and <strong>right before</strong> the <strong>next</strong> field</p>
</li>
<li>
<p dir="auto"><strong>Any</strong> field is, <strong>either</strong> :</p>
<ul>
<li>
<p dir="auto">Any text, between <strong>two double</strong> quotes, <strong>beginning</strong> a line, possibly <strong>preceded</strong> with <strong>blanks</strong> characters and followed with a comma, as <strong><code>"xxxxxx",</code></strong></p>
</li>
<li>
<p dir="auto">Any text, between <strong>two double</strong> quotes, itself surrounded by <strong>two</strong> commas, as <strong><code>,"xxxxxx",</code></strong></p>
</li>
<li>
<p dir="auto">Any text, between <strong>two double</strong> quotes, <strong>preceded</strong> by a comma and ending a <strong>line</strong> or the <strong>very end</strong> of current file, as <strong><code>,"xxxxx"</code>CRLF</strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">The following regex, containing a <strong>recursive</strong> pattern, will find <strong>all</strong> the zones <strong>between two</strong> commas, which contains an <strong>even</strong> number of <strong><code>"</code></strong> ( <strong>double-quote</strong> characters ) :</p>
<p dir="auto"><strong><code>(?x)  (?:^\h*|,)  (?: (  "  (?:  [^"\r\n,]++  |  (?1)  )*  "  )  )+?   (?=,|\R|\z)</code></strong></p>
<p dir="auto">For instance, given this <strong>sample</strong>, that you’ll copy in a <strong>new</strong> tab :</p>
<pre><code class="language-z">"0","0","","","","","","","","","","","","",""

"Field1","Field2","Field3","Field4","Field5","Field6","Field7","Field8","123 Main "St AptD"","","Dallas","TX","12345","","","","","","","","","","","","","","","","","","","","","","",""

"Field1","Field2","Field3","Field4","Field5","Field6","Field7","Field8","This fie"ld is NOT correct","","Dallas","TX","12345","","","","","","","","","","","","","","","","","","","","","","",""


," abcde","","ijk   "123"," 987 "This is"a small""pie"""ce of"text for"  tests" !!","","abc"de"fgh"ij","12345"

" abcde","","ijk   "123"," 987 "This is"a small""pie"""ce of"text for"  tests" !!","","abc"de"fgh"ij","12345"


"","","",","","","",""

","","","","",""

"   """    """   """    "
"   " "    """   """    "

1234567890","","","","",""

      " abcde","","ijk   "123"," 987 "This is"a small""pie"""ce of"text for"  tests" !!","","abc"de"fgh"ij","12345"
</code></pre>
<ul>
<li>
<p dir="auto">Open the Mark dialog ( <strong><code>Ctrl + M</code></strong> )</p>
</li>
<li>
<p dir="auto">Paste the above <strong>regex</strong> in the <strong><code>Find what:</code></strong> zone</p>
</li>
<li>
<p dir="auto">Preferably, tick the <strong><code>Purge for each search</code></strong> option</p>
</li>
<li>
<p dir="auto">Possibly, tick the <strong><code>Wrap around</code></strong> option</p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular expression</code></strong> search mode</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Mark All</code></strong> button</p>
</li>
</ul>
<p dir="auto">=&gt; All the fields <strong><code>,........,</code></strong>  containing an <strong>even</strong> number of <strong><code>"</code></strong> ( thus any <strong>correct</strong> field ), are marked in <strong>red</strong> style. This means that any zone, <strong>still unmarked</strong>, contains an <strong>odd</strong> number of <strong>double quotes</strong>, probably indicating one <strong><code>"</code></strong> character, too <strong>many</strong> or too <strong>few</strong> ;-))</p>
<p dir="auto">Note that, for a <strong>correct scanning</strong> process of the text, the <strong>regex</strong> marks from the <strong>comma</strong>, before <strong>each</strong> zone <strong><code>"....."</code></strong> till the <strong><code>"</code></strong>, right before the <strong>next comma</strong> !</p>
<p dir="auto">You may, as well, use the <strong><code>Find</code></strong> dialog to visualize <strong>each correct</strong> field, one a a time !</p>
<p dir="auto">Here is a snapshot of the sample, after the <strong>mark</strong> operation :</p>
<p dir="auto"><img src="/assets/uploads/files/1611808444295-2c764ef9-1799-4107-ad48-dcdb09438eb4-image.png" alt="2c764ef9-1799-4107-ad48-dcdb09438eb4-image.png" class=" img-fluid img-markdown" /></p>
<hr />
<p dir="auto">As you can see, all the fields <strong>non</strong> marked are <strong>incorrect</strong> in some ways and need <strong>examination</strong>.</p>
<p dir="auto">Note, also, that it’s <strong>impossible</strong> build up a regex in order to get the <strong>opposite</strong> logic, i.e. which would match the <strong>general</strong> case of any zone, between <strong>two commas</strong>, containing an <strong>odd</strong> number of <strong>double quotes</strong> inside !</p>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62254</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62254</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 28 Jan 2021 04:56:01 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Thu, 28 Jan 2021 01:55:30 GMT]]></title><description><![CDATA[<p dir="auto"><code>(,"[^\r\n][^"]*)("[\w\s]*)(")([^"]*",)</code></p>
<p dir="auto">This is the solution that worked. I had to include the <code>\r\n</code> earlier in the line of code so it ignored the CRLF.<br />
This is now the desired result.</p>
<p dir="auto"><img src="/assets/uploads/files/1611798881765-5ad38658-3c7f-48a1-aac6-4f54d598e582-image.png" alt="5ad38658-3c7f-48a1-aac6-4f54d598e582-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Thank you <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> and <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a>  for your help!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62253</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62253</guid><dc:creator><![CDATA[TexasKCFan]]></dc:creator><pubDate>Thu, 28 Jan 2021 01:55:30 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Wed, 27 Jan 2021 23:51:44 GMT]]></title><description><![CDATA[<p dir="auto">My apologies Terry I thought you were Peter. Thank you for the input!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62250</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62250</guid><dc:creator><![CDATA[TexasKCFan]]></dc:creator><pubDate>Wed, 27 Jan 2021 23:51:44 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Wed, 27 Jan 2021 23:49:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: TexasKCFan">@<bdi>TexasKCFan</bdi></a> said in <a href="/post/62248">Finding multiple words inside extra quotes</a>:</p>
<blockquote>
<p dir="auto">Here is the results I get with the solution you gave me.</p>
</blockquote>
<p dir="auto">Sorry it was not a solution. I was just pointing out that your requirement to exclude certain characters had been coded incorrectly, and how it might be coded. I didn’t do any tests.</p>
<p dir="auto">I haven’t been following this thread so don’t feel that I could provide one, others who have already presented some ideas might be the better ones to extend those solutions for your latest request.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62249</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62249</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Wed, 27 Jan 2021 23:49:40 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Wed, 27 Jan 2021 23:40:13 GMT]]></title><description><![CDATA[<p dir="auto">Here is the results I get with the solution you gave me. The correct result along with incorrect results from the end of one line to the beginning of the next. I’m trying to figure out what to add so it won’t pick up the false results that include CRLF.</p>
<p dir="auto"><img src="/assets/uploads/files/1611790757607-fa27011d-1f83-44a7-9cef-7c81db2d9535-image.png" alt="fa27011d-1f83-44a7-9cef-7c81db2d9535-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/62248</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62248</guid><dc:creator><![CDATA[TexasKCFan]]></dc:creator><pubDate>Wed, 27 Jan 2021 23:40:13 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Wed, 27 Jan 2021 23:08:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: TexasKCFan">@<bdi>TexasKCFan</bdi></a> said in <a href="/post/62244">Finding multiple words inside extra quotes</a>:</p>
<blockquote>
<p dir="auto">(^\r\n)*</p>
</blockquote>
<p dir="auto">Did you mean <code>[^\r\n]*</code> instead. What you wrote means a group of characters with the start of a line followed by carriage return/line feed, effectively an empty line.</p>
<p dir="auto">Terry</p>
<p dir="auto">PS I should add that the <code>*</code> also meant this group can be ignored if not found and the rest of the regex would then be processed.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62245</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62245</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Wed, 27 Jan 2021 23:08:03 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Wed, 27 Jan 2021 22:37:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Thank you so much! Yes you were correct with the regex I tried to enter. Showing my noob status with my first post lol. Thank you for the guidance!</p>
<p dir="auto">Your solution absolutely returned the values I am looking for but I am also getting false positives from every line due to wrap around effect from the end of one line to the next. Here’s the value it returned as a result:</p>
<pre><code>1  ,"CRLF
2 "Field1",
</code></pre>
<p dir="auto">I attempted add a piece to not include CR or LR <code>\r\n</code> to exclude these false positives and was unsuccessful. Is there a way to further refine my search?</p>
<p dir="auto"><code>(,"[^"](^\r\n)*)("[\w\s\]*)(")([^"]*",)</code></p>
<p dir="auto">However, my incorrect modification actually exposed an issue I didn’t know existed. A misplaced comma delimiter separating double quote text qualifiers. I will be keeping this line of code to identify these issues so I can correct them.</p>
<p dir="auto"><code>(,"[^"](^\r\n)*)("[\w\s\]*)(")([^"]*",)</code></p>
<pre><code>,"123 Main St,","","Dallas",TX"12345","</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/62244</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62244</guid><dc:creator><![CDATA[TexasKCFan]]></dc:creator><pubDate>Wed, 27 Jan 2021 22:37:01 GMT</pubDate></item><item><title><![CDATA[Reply to Finding multiple words inside extra quotes on Wed, 27 Jan 2021 20:17:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/texaskcfan" aria-label="Profile: TexasKCFan">@<bdi>TexasKCFan</bdi></a> ,</p>
<p dir="auto">Assuming you meant: <code>(,"[^"]*)("\w*)(")([^"]*",)</code> as your regex, with real data of</p>
<pre><code>,"123 Main St Apt "D"",
,"123 Main "St Apt D"",
</code></pre>
<p dir="auto">(so real quotes, not “smart” quotes)</p>
<p dir="auto">… then the problem is that <code>("\w*)</code> is looking for word characters only.  Spaces are not word characters. If you want word chars or spaces in that match, then make a character class that looks for both: <code>("[\w\s]*)</code></p>
<p dir="auto">Full regex = <code>(,"[^"]*)("[\w\s]*)(")([^"]*",)</code></p>
<p dir="auto">This regex found the two example lines above in my test.  If your data is different, it may or may not work for you.</p>
<p dir="auto">Please notice I used backticks around the regex like <code>`(,"[^"]*)("[\w\s]*)(")([^"]*",)`</code>, so that the regex would be treated as plain text, and the asterisks wouldn’t be turned into italics by the forum.  Similarly, I used the <code>&lt;/&gt;</code> forum button (or equivalently, the plaintext markdown syntax <code>```</code> on a line before and after the data) to mark the example text as pure text, so that the forum wouldn’t convert quotes to “smart quotes”.</p>
<p dir="auto">-—</p>
<p dir="auto"><em>Do you want regex search/replace help?  Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you.  All example text should be marked as literal text using the <code>&lt;/&gt;</code> toolbar button or manual <a href="https://community.notepad-plus-plus.org/topic/14262/how-to-markdown-code-on-this-forum/4">Markdown syntax</a>. To make <code>regex in red</code> (and so they keep their special characters like *), use backticks, like <code>`^.*?blah.*?\z`</code>. Screenshots can be pasted from the clipboard to your post using <code>Ctrl+V</code> to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have <strong>and</strong> the text you want to get from that data; include examples of things that <strong>should match</strong> and be transformed, <strong>and</strong> things that <strong>don’t match</strong> and should be left alone; show <strong>edge cases</strong> and make sure you examples are as <strong>varied</strong> as your real data.  Show the regex you already tried, <strong>and why</strong> you thought it should work; tell us what’s wrong with what you <strong>do</strong> get. Read the official <a href="https://npp-user-manual.org/docs/searching/#regular-expressions" rel="nofollow ugc">NPP Searching / Regex docs</a> and the forum’s <a href="https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regex-documentation">Regular Expression FAQ</a>. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.</em></p>
]]></description><link>https://community.notepad-plus-plus.org/post/62237</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62237</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 27 Jan 2021 20:17:08 GMT</pubDate></item></channel></rss>