<?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[Is it possible...?]]></title><description><![CDATA[<p dir="auto">Dear Members</p>
<p dir="auto">sorry Im not a professional.<br />
I have a topic and searching for solutions:</p>
<p dir="auto">I have a bunch of saved html files and want to search for a keyword + a variable e.g. “password:” and the word behind " …" . The word behind would be the one I would ike to extract.<br />
Is this possible?<br />
Thanks a lot</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/18610/is-it-possible</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 21:06:09 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/18610.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 11 Dec 2019 00:20:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Is it possible...? on Wed, 02 Jun 2021 22:51:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/dipsi7772" aria-label="Profile: dipsi7772">@<bdi>dipsi7772</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">You said :</p>
<blockquote>
<p dir="auto">Strange thin is, on some files. just &lt;!doctype html&gt; this is the result.<br />
I would say al files are the same format , so Its mystious.</p>
</blockquote>
<p dir="auto">It’s <strong>not</strong> strange and it’s not related to <strong>file format</strong> at all ! The reason, is that , for files with <strong>big</strong> size, it may happen that the regex does <strong>not</strong> work properly and <strong>deletes</strong> all characters but the <strong>first</strong> line of your <strong><code>HTML</code></strong> files. Indeed, as the regex is :</p>
<p dir="auto"><strong><code>(?s).*?(?-si:pass(word)?.*?&gt;(.+?)(?=&lt;/div&gt;))|.+</code></strong></p>
<p dir="auto">The beginning <strong><code>(?s).*?(?-si:pass(word)?</code></strong> means that the regex engine selects <strong>all</strong> characters, even displayed on <strong>several</strong> lines, from <strong>current</strong> position of the caret till the <strong>first</strong> word <strong><code>pass</code></strong> or <strong><code>password</code></strong>. In some files, this range of characters can be <strong>significative</strong> and this fact could explain the <strong>non-expected</strong> results !</p>
<p dir="auto">If your <strong><code>HTML</code></strong> files are <strong>not</strong> important <strong>nor</strong> confidentiel, simply e-mail me <strong>one</strong> of these files, which produces errors. I’ll try to find out an <strong>other</strong> regex which works <strong>correctly</strong>, in <strong>all</strong> cases ;-))</p>
<hr />
<p dir="auto">Next, you said :</p>
<blockquote>
<p dir="auto">Is it maybe possible to implement a rule that avoids duplicate results?</p>
</blockquote>
<p dir="auto">My question is : In the copied <strong><code>HTML</code></strong> files, that contains the <strong>passwords</strong> ( <strong><code>1</code></strong> <strong>per</strong> line ), which is the <strong>maximum length</strong> of these files ?</p>
<p dir="auto">Depending of this <strong>length</strong>, a <strong>regex</strong> solution may be possible… However, if you don’t mind changing the <strong>initial</strong> order of these <strong>passwords</strong>, just use, for <strong>each</strong> copied <strong><code>HTML</code></strong> file, the <strong>two</strong> menu options, below :</p>
<ul>
<li>
<p dir="auto"><strong><code>Edit &gt; Line Operations &gt; Sort Line Lexicographically Ascending</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>Edit &gt; Line Operations &gt; Remove Consecutive Duplicate Lines</code></strong></p>
</li>
</ul>
<hr />
<p dir="auto">Finally, you said :</p>
<blockquote>
<p dir="auto">Another thing is, even I choose “Automatischer Zeienumbruch” each line is writte ine ONE line, not in a second one which woud avoid the vertical scrolling.</p>
</blockquote>
<p dir="auto">I’m sorry because I <strong>cannot</strong> guess what you’re speaking of :-(( Depending on your <strong>file ending</strong> characters, discussed previously, and using the appropriate <strong>Replace</strong> regex :</p>
<p dir="auto"><strong><code>\2\r\n</code></strong> for <strong>Windows</strong> files</p>
<p dir="auto">OR</p>
<p dir="auto"><strong><code>\2\n</code></strong> for <strong>Unix</strong> files</p>
<p dir="auto">The <strong><code>View &gt; Word Wrap</code></strong> option should work <strong>correctly</strong> !?</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49419</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49419</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 02 Jun 2021 22:51:27 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Mon, 23 Dec 2019 02:38:45 GMT]]></title><description><![CDATA[<p dir="auto">Is it maybe possible to implement a rule that avoids duplicate results?</p>
<p dir="auto">Another thing is, even I choose “Automatischer Zeienumbruch” each line is writte ine ONE line, not in a second one which woud avoid the vertical scrolling.</p>
<p dir="auto">Best Regards Friends</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49412</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49412</guid><dc:creator><![CDATA[dipsi7772]]></dc:creator><pubDate>Mon, 23 Dec 2019 02:38:45 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Mon, 23 Dec 2019 02:08:13 GMT]]></title><description><![CDATA[<p dir="auto">Dear guy038,</p>
<p dir="auto">thanks for clarification. Your proposal works good. Anyway its still a job to manuallly copy the eexpressions out of the sentences :) but its way better than without the code.<br />
Strange thin is, on some files. just &lt;!doctype html&gt; this is the result.<br />
I would say al files are the same format , so Its mystious.<br />
Anyway whis you a nice xMas all community members and thanks again=)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49411</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49411</guid><dc:creator><![CDATA[dipsi7772]]></dc:creator><pubDate>Mon, 23 Dec 2019 02:08:13 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Sun, 15 Dec 2019 13:36:29 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 in <a href="/post/49211">Is it possible...?</a>:</p>
<blockquote>
<p dir="auto"><a href="https://en.wikipedia.org/wiki/Newline#Representation" rel="nofollow ugc">https://en.wikipedia.org/wiki/Newline#Representation</a></p>
</blockquote>
<p dir="auto">OT to the main thread here, but it is interesting from that article that the Mac line-endings (carriage-return only) that Notepad++ still supports are for an OS whose last release was before the first release of N++ (if I have my dates straight).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49212</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49212</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 15 Dec 2019 13:36:29 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Sun, 15 Dec 2019 10:10:17 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/dipsi7772" aria-label="Profile: dipsi7772">@<bdi>dipsi7772</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>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dipsi7772" aria-label="Profile: dipsi7772">@<bdi>dipsi7772</bdi></a>, you said :</p>
<blockquote>
<p dir="auto">I googled but still not sure about the meaning of Unix EOL</p>
</blockquote>
<p dir="auto">I <strong>missed</strong> that sentence. Refer to the link, below, for <strong>general</strong> information about <strong>new-line</strong> definition :</p>
<p dir="auto"><a href="https://en.wikipedia.org/wiki/Newline#Representation" rel="nofollow ugc">https://en.wikipedia.org/wiki/Newline#Representation</a></p>
<hr />
<p dir="auto">To be <strong>rigorous</strong>, I’ve made a <strong>slight</strong> error, in my <strong>last</strong> proposed <strong>search</strong> regex ! In order to extract <strong>target</strong> from lines of that form :</p>
<p dir="auto">/&gt;&lt;br /&gt;password&gt;target&lt;/div&gt;  OR   /&gt;&lt;br /&gt;pass&gt;target&lt;/div&gt;   ( when <strong>NO</strong> character exists between the string <strong><code>pass(word)</code></strong> and <strong><code>&gt;target&lt;</code></strong> )</p>
<p dir="auto">I should have used the following <strong>search</strong> regex, with a <strong><code>*</code></strong>, instead of a <strong><code>+</code></strong>, at the <strong>indicated</strong> place !</p>
<pre><code class="language-z">SEARCH (?s).*?(?-si:pass(word)?.*?&gt;(.+?)(?=&lt;/div&gt;))|.+
                                ▲
                                │
</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49211</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49211</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 15 Dec 2019 10:10:17 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Sun, 15 Dec 2019 00:35:38 GMT]]></title><description><![CDATA[<p dir="auto">Im soooo happy =) this works … Thank you all!! This made my day :)<br />
You are great !! Thanks so much=)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49210</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49210</guid><dc:creator><![CDATA[dipsi7772]]></dc:creator><pubDate>Sun, 15 Dec 2019 00:35:38 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Sat, 14 Dec 2019 10:30:00 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/dipsi7772" aria-label="Profile: dipsi7772">@<bdi>dipsi7772</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>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dipsi7772" aria-label="Profile: dipsi7772">@<bdi>dipsi7772</bdi></a>, many <strong>thanks</strong> for trying to find out some general <strong>rules</strong> in order to <strong>isolate</strong> your different <strong>target</strong> strings more easily !</p>
<p dir="auto">You said :</p>
<blockquote>
<p dir="auto">1 I found that there is always a &lt;/div&gt; directly next to the target. But unfortunately there are also other lines with &lt;/div&gt;, but without the target.</p>
</blockquote>
<blockquote>
<p dir="auto">2 So at the end, the only fix mark is the word “pass” or the word “password” before the target. Unfortunately I have to inform about a further issue:</p>
</blockquote>
<blockquote>
<p dir="auto">3 The word “password” is not everytime directly before the target … sometimes there is also letters numbers signs or free spaces between them.</p>
</blockquote>
<blockquote>
<p dir="auto">4 Regarding your question: The target can contain every, sign,letter, special sign …everything you can imagine.</p>
</blockquote>
<hr />
<p dir="auto">If so, I think that the <strong>new</strong> regex S/R , below, should meet these <strong><code>4</code></strong> criteria !</p>
<p dir="auto">SEARCH <strong><code>(?s).*?(?-si:pass(word)?.+?&gt;(.+?)(?=&lt;/div&gt;))|.+</code></strong></p>
<p dir="auto">REPLACE <strong><code>\2\r\n</code></strong> ( or <strong><code>\2\n</code></strong> if your files use <strong>Unix</strong> <strong>EOL</strong> syntax )</p>
<ul>
<li>
<p dir="auto">The look-around <strong><code>(?=&lt;/div&gt;)</code></strong>, as well as the <strong><code>(?-si:pass(word)?...</code></strong> syntax, should satisfy your <strong>first</strong> criterion</p>
</li>
<li>
<p dir="auto">The part <strong><code>(?-si:pass(word)?...)</code></strong>, which matches the word <strong><code>pass</code></strong> or <strong><code>password</code></strong>, with this <strong>exact</strong> case, satisfies your <strong>second</strong> criterion</p>
</li>
<li>
<p dir="auto">Then, the part <strong><code>.+?&gt;</code></strong>, which matches the <strong>shortest</strong> range of <strong>standard</strong> chars, till a <strong><code>&gt;</code></strong> symbol, satisfies your <strong>third</strong> criterion</p>
</li>
<li>
<p dir="auto">Finally, the part <strong><code>(.+?)</code></strong>, which stores, as <strong>group<code>1</code></strong>, any range of <strong>standard</strong> characters, due to the in-line <strong>modifiers</strong> <strong><code>(?-si:....)</code></strong>, till the <strong>nearest</strong> string <strong><code>&lt;/div&gt;</code></strong> excluded ( located right <strong>after</strong> all the target characters ), satisfies your <strong>fourth</strong> criterion</p>
</li>
</ul>
<hr />
<p dir="auto">As <a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a> said, use the <strong>Find in Files</strong> dialog ( <strong><code>Ctrl + Shift + F </code></strong> )</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">So, except for the SEARCH and REPLACE <strong>updated</strong> zones, just follow the instructions given in my <strong>first</strong> post !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49183</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49183</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 14 Dec 2019 10:30:00 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Fri, 13 Dec 2019 07:28:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dipsi7772" aria-label="Profile: dipsi7772">@<bdi>dipsi7772</bdi></a> You have the simple search tab open, and you need the following tabs of the search window, replace or find and replace in files</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49181</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49181</guid><dc:creator><![CDATA[andrecool-68]]></dc:creator><pubDate>Fri, 13 Dec 2019 07:28:18 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Fri, 13 Dec 2019 00:21:36 GMT]]></title><description><![CDATA[<p dir="auto">Dear <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a>   dear <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>, dear <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a><br />
thank you so much for your support. All of you seem to be very smart people if I read through your thoughts and realize how difficult it is get the target out of the big text.</p>
<p dir="auto">As I dont want to make you guys headache I have checked now several different files of the big bunch to find out a “rule” or a repeated “sign” which is situated around the target.</p>
<p dir="auto">I found that there is always a   &lt;/div&gt;  directly next to the target. But unfortunately there are also other lines with &lt;/div&gt;, but without the target.</p>
<p dir="auto">So at the end, the only fix mark is the word “pass” or the word “password” before the target. Unfortunately I have to inform about a further issue:<br />
The word “password” is not everytime directly before the target … sometimes there is also letters numbers signs or free spaces between them.<br />
Regarding your question: The target can contain every, sign,letter, special sign …everything you can imagine.</p>
<p dir="auto">So from my unprofessional point of view:</p>
<p dir="auto">its just possible to extract just the line which contains the strings “pass” “password” and        “&lt;/div&gt;”.<br />
As I have almost 3000 html files to search, just extract the lines would also help me a lot.</p>
<p dir="auto">Should I try your proposals now or have you any remarks?<br />
I googled but still not sure about the meaning of Unix EOL</p>
<p dir="auto">Search field should look like this?<br />
<img src="/assets/uploads/files/1576196413436-96f34881-14da-4237-8ef5-1a24708f2526-image.png" alt="96f34881-14da-4237-8ef5-1a24708f2526-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Not sure about the search options you mentioned.<br />
Thanks for all guys!!!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49178</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49178</guid><dc:creator><![CDATA[dipsi7772]]></dc:creator><pubDate>Fri, 13 Dec 2019 00:21:36 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Thu, 12 Dec 2019 12:17:57 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/dipsi7772" aria-label="Profile: dipsi7772">@<bdi>dipsi7772</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">First, <strong>Peter</strong> said :</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> is going to have to jump in to do it in one fell swoop. Barring that (he may be busy, or away, or not interested in this one)</p>
</blockquote>
<p dir="auto">Indeed, I was away for a <strong>long</strong> week-end !</p>
<p dir="auto">Secondly, <a class="plugin-mentions-user plugin-mentions-a" href="/user/dipsi7772" aria-label="Profile: dipsi7772">@<bdi>dipsi7772</bdi></a> said :</p>
<blockquote>
<p dir="auto">This is a original line of the file:</p>
</blockquote>
<blockquote>
<p dir="auto">/&gt;&lt;br /&gt;password&lt;br /&gt;target&lt;/div&gt;</p>
</blockquote>
<p dir="auto">So I assume that the different <strong>targets</strong> are characters between the <strong>nearest</strong> <strong><code>&gt;</code></strong> and <strong><code>&lt;</code></strong> symbols, after the word <strong><code>password</code></strong>, with this <strong>exact</strong> case, followed with <strong>few</strong> characters. In this case, here is a <strong>destructive</strong> method, which need to be run <strong>only</strong> on a <strong>copy</strong> of your bunch of <strong><code>.html</code></strong> files</p>
<p dir="auto">To sump up :</p>
<ul>
<li>
<p dir="auto"><strong>Copy</strong> the directory, containing all your <strong><code>.html</code></strong> files, to an <strong>other</strong> location</p>
</li>
<li>
<p dir="auto">Start Notepad++</p>
</li>
<li>
<p dir="auto">Open the <strong>Search in Files</strong> dialog ( <strong><code>Ctrl + Shift + F</code></strong> )</p>
</li>
<li>
<p dir="auto">SEARCH <strong><code>(?s-i).*?password.+?&gt;(.+?)(?=&lt;)|.+</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>\1\r\n</code></strong> ( or <strong><code>\1\n</code></strong> if your files use <strong>Unix</strong> <strong>EOL</strong> syntax )</p>
</li>
<li>
<p dir="auto">FILTERS <strong><code>*.html</code></strong></p>
</li>
<li>
<p dir="auto">DIRECTORY The <strong>absolute</strong> location of the <strong>COPY</strong> of all your <strong><code>.html</code></strong> files ( Do <strong>NOT</strong> use your <strong>original</strong> files )</p>
</li>
<li>
<p dir="auto">Tick the <strong><code>Wrap around</code></strong> button</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>Replace in Files</code></strong> button</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Yes</code></strong> button of the small dialog <strong>Are you sure?</strong></p>
</li>
</ul>
<p dir="auto">=&gt; Each copy, of an original <strong><code>.html</code></strong> file, should have been <strong>drastically</strong> decreased and simply contains a list of <strong>all</strong> passwords, one per <strong>line</strong>, contained in the <strong>original</strong> file ;-))</p>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">As usual, the <strong><code>(?s-i)</code></strong> in-line <strong>modifiers</strong> mean that :</p>
<ul>
<li>
<p dir="auto">The <strong>dot</strong> <strong><code>.</code></strong> character represents any <strong>single</strong> character, even <strong>EOL</strong> chars ( <strong><code>(?s)</code></strong> )</p>
</li>
<li>
<p dir="auto">The search is processed in a <strong>sensitive to case</strong> way ( <strong><code>(?-i)</code></strong> )</p>
</li>
</ul>
</li>
<li>
<p dir="auto">Then, The part <strong><code>.*?password.+?&gt;</code></strong>  looks, from <strong>beginning</strong> of each file, for the <strong>shortest</strong> range of any character, till the string <strong><code>paasword</code></strong>, with this <strong>exact</strong> case, followed with some characters till the <strong>nearest</strong> <strong><code>&gt;</code></strong> symbol</p>
</li>
<li>
<p dir="auto">Now, the <strong><code>(.+?)(?=&lt;)</code></strong> part stores, as <strong>group <code>1</code></strong>, all the <strong>subsequent</strong> characters till the condition contained in the <strong>look-around</strong> structure is <strong>true</strong>, i.e. till the <strong>nearest</strong> <strong><code>&lt;</code></strong> symbol if found</p>
</li>
<li>
<p dir="auto">In replacement, the “<strong>value</strong>” of each password <strong><code>\1</code></strong> is simply rewritten, followed with <strong>new-line</strong> characters ( <strong><code>\r\n</code></strong> or <strong><code>\n</code></strong> )</p>
</li>
<li>
<p dir="auto">At the end, if the word <strong><code>password</code></strong> , with this <strong>exact</strong> case, <strong>cannot</strong> be found, the <strong>second</strong> alternative <strong><code>.+</code></strong>, after the <strong>alternation</strong> symbol <strong><code>|</code></strong>,  selects all the <strong>remaining</strong> characters of <strong>current</strong> scanned file and deletes them, because <strong>group <code>1</code></strong> is <strong>not</strong> defined</p>
</li>
</ul>
<p dir="auto"><strong>Remarks</strong> :</p>
<ul>
<li>
<p dir="auto">Notice that <strong>all</strong> quantifiers of the <strong>first</strong> alternative of the search regex are <strong>lazy</strong> quantifiers, i. e. it grasps as <strong>little</strong> chars as possible, though satisfying the <strong>subsequent</strong> parts of the <strong>overall</strong> regex</p>
</li>
<li>
<p dir="auto">When an <strong><code>.html</code></strong> file do <strong>not</strong> contain any word <strong><code>password</code></strong>, <strong>all</strong> its contents are just replaced with a <strong>single</strong> line-break !</p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49157</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49157</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 12 Dec 2019 12:17:57 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Wed, 11 Dec 2019 21:47:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dipsi7772" aria-label="Profile: dipsi7772">@<bdi>dipsi7772</bdi></a> said in <a href="/post/49113">Is it possible...?</a>:</p>
<blockquote>
<p dir="auto">want to search for a keyword + a variable</p>
</blockquote>
<p dir="auto">I used both examples you provided in an attempt to extract JUST the “variable” you seek. I have succeeded insofar as the examples. My concern is that you probably have NOT provided clear enough examples, so in the “real” world situation you may find it does NOT work as expected.</p>
<p dir="auto">In the examples you provided the “variable” seems to be surrounded by quotes (of some type, there are many), and in another part of the example it has the “&gt;” and “&lt;” surrounding it. So in the absence of any further information I have had to assume that the “variable” is composed of numbers and letters, thus 0-9 and a-z (upper or lower case) ONLY!</p>
<p dir="auto">So see the first code block below showing what I tested my regex on and in the second block what running the regex produced.</p>
<p dir="auto">So the regex is (Search mode must be Regular expression and wrap around ticked):<br />
Find What:<code>(?i-s)(^.+?password(.+)?[“&gt;]+([0-9a-z]+).+?(\R|\z))|(.+\R|\z)</code><br />
Replace With:<code>\3\4</code></p>
<p dir="auto">So as a description of the regex:<br />
(?i-s) these will set “match case and “. matches newline” to required settings. This prevents your Replace settings possibly preventing my regex from functioning correctly.<br />
Then we start searching from the start of a line for the word “password” (case insensitive), so “Password” and passwoRD” would also work.<br />
After finding that string we continue so long as we do not encounter a quote and a “&gt;” symbol. That’s where I’ve had to make some assumptions.<br />
Next we pass over those special symbols (quote and &gt;)<br />
Then we start reading the “variable” portion (hopefully). Again, an assumption that it is comprised of ONLY letters and numbers.<br />
Then we continue reading to the end of the line (including the EOL character or end of file).<br />
Immediately after this search pattern we have a “|”. This denotes an alternate path we can take. So in the situation where the line does NOT contain a “password” string we use this alternate path.<br />
Finally we come to the replacement text. In this case we want the 3rd group (variable) and the 4th group (EOL or end of file). We send these back into the file. Everything else has been erased.</p>
<p dir="auto">As I stated earlier I am concerned that the limited examples you provided will likely mean this regex will fail. Because of this (and just beacuse you should when testing something new), I would strongly suggest running my regex on a COPY of your files, and then afterwards doing some spot checks.</p>
<p dir="auto">Terry</p>
<pre><code>Line1: bla bla bla bla "Password “1"” bla bla bla
Line2: bla bla bla bla bla bla bla bla bla bla bla
Line3: bla "Password “22"” bla bla bla bla bla bla
Line4: bla bla bla bla bla bla bla bla bla bla bla
Line5: bla bla bla bla bla bla bla bla bla bla bla
Line6: bla bla bla bla bla bla "Password “3"” bla
/&gt;&lt;br /&gt;password&lt;br /&gt;target1&lt;/div&gt;
/&gt;&lt;br /&gt;word&lt;br /&gt;target&lt;/div&gt;
/&gt;&lt;br /&gt;pass&lt;br /&gt;target&lt;/div&gt;
/&gt;&lt;br /&gt;password&lt;br /&gt;target2&lt;/div&gt;
</code></pre>
<pre><code>1
22
3
target1
target2
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/49150</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49150</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Wed, 11 Dec 2019 21:47:53 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Wed, 11 Dec 2019 02:09:58 GMT]]></title><description><![CDATA[<p dir="auto">Im really sorry. I did not read the article in advance as I unfortunately not understand the content really good. I hope you could help me with a function code which Is not very hard to customize as I just began learning of programming.<br />
I understand what you mean, you would filter the content out step by step to have finaly just the search expression.</p>
<p dir="auto">I try to explain better:<br />
The “…” I just used as placeholders<br />
My file is looking like the following<br />
It also contains lines without the word “password”<br />
also possible are spaces or other signs between “password” and the “target word”<br />
but if this  wil be also extracted , it would be not too big problem<br />
I would “free” the output file again manually,no problem.<br />
Just deletting 95% of the other signs would be suitable.</p>
<p dir="auto">Line1: bla bla bla bla "Password “1"” bla bla bla<br />
Line2: bla bla bla bla bla bla bla bla bla bla bla<br />
Line3: bla "Password “2"” bla bla bla bla bla bla<br />
Line4: bla bla bla bla bla bla bla bla bla bla bla<br />
Line5: bla bla bla bla bla bla bla bla bla bla bla<br />
Line6: bla bla bla bla bla bla "Password “3"” bla<br />
…</p>
<p dir="auto">My aim would be to extract 1 and 2 and 3 and a following strings which a situated after  the word “password”</p>
<p dir="auto">This is a original line of the file:</p>
<p dir="auto"><strong>/&gt;&lt;br /&gt;password&lt;br /&gt;target&lt;/div&gt;</strong></p>
<p dir="auto">I would need the variable which I have called “target”</p>
<p dir="auto">Could you please help me ?:(<br />
Really appreciate!!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49122</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49122</guid><dc:creator><![CDATA[dipsi7772]]></dc:creator><pubDate>Wed, 11 Dec 2019 02:09:58 GMT</pubDate></item><item><title><![CDATA[Reply to Is it possible...? on Wed, 11 Dec 2019 01:02:50 GMT]]></title><description><![CDATA[<p dir="auto">Possible? yes.</p>
<p dir="auto">From the simplistic end, you are looking for <code>(password: \S+)</code>, which would be a sub-expression of the regex.  However, you need more than that (I’ll come back to this later).</p>
<p dir="auto">Once you had the full regular expression for both the search term and the replace term, I would do the following:</p>
<ol>
<li>Copy all the files to a new location (don’t work with your original data)</li>
<li><strong>Search &gt; Find In Files</strong></li>
<li>Specify the right <strong>Directory</strong> for the new location of the files</li>
<li>Set the <strong>Find What</strong> and <strong>Replace with</strong></li>
<li>Replace all</li>
</ol>
<p dir="auto">Back to the regular expression: I spend about 10 minutes trying to craft one master regex which would do it all.  I failed. I was attempting to do something akin to <code>^.*?(password: (\S+?))?.*(\R|\Z)?</code>, replacing with <code>(?{2}$1$3|)</code>, which I got to from saying to myself “if a line doesn’t have <code>password: \S+</code>, replace the whole line including the newline with nothing; if it is found, replace it with just <code>password: ...</code> and a newline”.  Unfortunately, neither that, nor any variant I tried before or after worked.</p>
<p dir="auto">It might make it easier if you could guarantee that there aren’t any lines in the files that <em>don’t</em> contain <code>password: ...</code> somewhere in the line.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> is going to have to jump in to do it in one fell swoop.  Barring that (he may be busy, or away, or not interested in this one), I would do a multistep sequence in the <strong>Find in Files</strong>.  First, I would try to find any text on a given line that precedes <code>password: \S+</code>, and delete it.  Then I would do something that would delete anything after that sub-expression.  Then I would look for any lines that don’t contain that, and delete them (including newline).  What remains would be just the prefix/value pairs.</p>
<p dir="auto">Maybe if you could confirm things about your data, like: do all lines have passwords, or just some? do you care if there are blank lines left in the resulting file, or do we have to delete all lines that don’t contain passwords?  is there a limit as to what text can come before <code>password</code>?  is there a space (or any number of spaces) between the <code>password:</code> prefix and the value, or can it be either space or no space? Can anything come after the password field on the line, or can anything after <code>password: </code> be considered the password values; if things can come after the password field, are there characters that cannot be part of the password, or a character that’s guaranteed to be a separator character?  Anything else that would help us not require a turing-complete program to determine if there’s a password on the line or not?</p>
<p dir="auto">The more you give us, the better.  Also read my boilerplate below.</p>
<p dir="auto">-----</p>
<h3>Please Read And Understand This</h3>
<p dir="auto">FYI: I often add this to my response in regex threads, unless I am sure the original poster has seen it before. Here is some helpful information for finding out more about regular expressions, and for formatting posts in this forum (especially quoting data) so that we can fully understand what you’re trying to ask:</p>
<blockquote>
<p dir="auto">This forum is formatted using <a href="https://daringfireball.net/projects/markdown/syntax" rel="nofollow ugc">Markdown</a>. Fortunately, it has a formatting toolbar above the edit window, and a preview window to the right; make use of those. The <code>&lt;/&gt;</code> button formats text as “code”, so that the text you format with that button will come through literally; use that formatting for example text that you want to make sure comes through literally, no matter what characters you use in the text (otherwise, the forum might interpret your example text as Markdown, with unexpected-for-you results, giving us a bad indication of what your data really is). Images can be pasted directly into your post, or you can hit the image button. (For more about how to manually use Markdown in this forum, please see <a href="https://community.notepad-plus-plus.org/topic/14262/how-to-markdown-code-on-this-forum/4">@Scott-Sumner’s post in the “how to markdown code on this forum” topic</a>, and my updates <a href="https://community.notepad-plus-plus.org/topic/14262/how-to-markdown-code-on-this-forum/9">near the end</a>.) Please use the preview window on the right to confirm that your text looks right before hitting SUBMIT. If you want to clearly communicate your text data to us, you <em>need</em> to properly format it.</p>
</blockquote>
<blockquote>
<p dir="auto">If you have further search-and-replace (“matching”, “marking”, “bookmarking”, regular expression, “regex”) needs, study <a href="https://npp-user-manual.org/docs/searching/#regular-expressions" rel="nofollow ugc">the official Notepad++ searching using regular-expressions docs</a>, as well as <a href="https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regex-documentation">this forum’s FAQ</a> and the documentation it points to. Before asking a new regex question, understand that for future requests, many of us will expect you to show what data you have (exactly), what data you want (exactly), what regex you already tried (to show that you’re showing effort), why you thought that regex would work (to prove it wasn’t just something randomly typed), and what data you’re getting with an explanation of why that result is wrong. When you show that effort, you’ll see us bend over backward to get things working for you. If you need help formatting, see the paragraph above.</p>
</blockquote>
<blockquote>
<p dir="auto">Please note that for all regex and related queries, it is best if you are explicit about what needs to match, <em>and</em> what <em>shouldn’t</em> match, and have multiple examples of both in your example dataset. Often, what <em>shouldn’t match</em> helps define the regular expression as much or more than what <em>should match</em>.</p>
</blockquote>
<blockquote>
<p dir="auto">Here is the way I usually break down trying to figure out a regex (whether it’s for myself or for helping someone in the forum):</p>
</blockquote>
<blockquote>
<ol>
<li>Compare what portions of each line I want to match is identical to every other one (“constants”), and what parts do I want to allow to be different in each line (“variables”) but still be part of the match.</li>
</ol>
</blockquote>
<blockquote>
<ol start="2">
<li>Look at both the variables and constants, and see what portions of each I’ll want to keep or move around, vs which parts get thrown away completely. Each sub-component that I want to keep will be put in a regex group. Anything that gets completely thrown away doesn’t <em>need</em> to be in a group, though sometimes I put it in a numbered <code>(___)</code> or unnumbered <code>(?:___)</code> group anyway, if I have a good reason for it. Anything that needs to be split apart, I break into multiple groups, instead of having it as one group.</li>
</ol>
</blockquote>
<blockquote>
<ol start="3">
<li>For each group, I do a mental “how would I describe to my son how to correctly match these characters?” – which should hopefully give me a simple, foolproof algorithm of characters that must match or must not match; then I ask, “how would I translate those instructions into regex sequences?” If I don’t know the answer to the second, I read documentation, or ask a specific question.</li>
</ol>
</blockquote>
<blockquote>
<ol start="4">
<li>try it, debug, iterate.</li>
</ol>
</blockquote>
]]></description><link>https://community.notepad-plus-plus.org/post/49116</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49116</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 11 Dec 2019 01:02:50 GMT</pubDate></item></channel></rss>