<?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[Replacing variable length file paths in a GEDCOM file]]></title><description><![CDATA[<p dir="auto">Fellow Notepad++ Users,</p>
<p dir="auto">Could you please help me the the following search-and-replace problem I am having?</p>
<p dir="auto">We use a text format file called GEDCOM (file ext = “.ged”) to import family trees to our online service.  Because it’s a text file it cannot include media, but it can include links to media.  But these links are to the local folders on the user’s computer and we have to convert those to the file path on the server where the images reside.</p>
<p dir="auto">Here is the data I currently have (“before” data):</p>
<pre><code>A typical line will look something like this:

1 FILE /Users/johnssmith/Documents/FamilyHistory/Heredis/TestMedia.hmw/Media/#2/HEDGCOCK James Ernest (1865-1954).jpg

</code></pre>
<ul>
<li>
<p dir="auto">There will be multiple lines in the file and they all commence "1 FILE "</p>
</li>
<li>
<p dir="auto">The old file path always starts at char 8 in the string but may be: \ / ~ or a drive letter, so position 8 is the most reliable start point</p>
</li>
<li>
<p dir="auto">The length of the file path can be infinitely variable within a single file but it always ends with a final “/”</p>
</li>
<li>
<p dir="auto">The objective is to replace everything from and including position 8 to the final “/”  with a parameter that is, for example “/Smith_1234/”</p>
</li>
</ul>
<p dir="auto">Here is how I would like that data to look (“after” data):</p>
<pre><code>1 FILE /Smith_1234/HEDGCOCK James Ernest (1865-1954).jpg

</code></pre>
<p dir="auto">To accomplish this, I have tried using the following Find/Replace expressions and settings</p>
<pre><code>Find What = `highlighted occurence`
Replace With = `/smith_1234/`
Search Mode = NORMAL
Dot Matches Newline = NOT CHECKED
</code></pre>
<p dir="auto">Then repeat for next variation of the file path</p>
<p dir="auto">It works but it’s tedious because I have to work through the file looking for the different variations.  It took long enough on a file with 4K lines but some of the files have 1million lines!!!</p>
<p dir="auto">I  know little about regex but I have toyed with macros.  However, this is completely outside my competence. Could you please help me find the solution?</p>
<p dir="auto">What I’d like to do is give one of our volunteers a macro to run on an open file, where they enter the bit between the “/     /” e.g. “smith_1234” amd hey presto!!</p>
<p dir="auto">Thank you.</p>
<p dir="auto">Paul Barrett<br />
Berkshire Family History Society</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22669/replacing-variable-length-file-paths-in-a-gedcom-file</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Nov 2026 10:26:31 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22669.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 03 Mar 2022 17:23:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Sat, 05 Mar 2022 08:26:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul-wormer" aria-label="Profile: paul-wormer">@<bdi>paul-wormer</bdi></a> The replacement string is constant so it’s a one-time entry into the expression the guys have devised for me.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74936</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74936</guid><dc:creator><![CDATA[Web Master]]></dc:creator><pubDate>Sat, 05 Mar 2022 08:26:41 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 17:17:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a> said in <a href="/post/74836">Replacing variable length file paths in a GEDCOM file</a>:</p>
<blockquote>
<p dir="auto">It took long enough on a file with 4K lines but some of the files have 1million lines!!!</p>
</blockquote>
<p dir="auto">I am sorry to bud in, but I noticed that your question is about  manually typing in  replacement strings. Are you certain you want to do this for 1 million lines? Or is the number of lines starting with <code>1 FILE</code>  small enough to do the typing in a finite time span? Just curious.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74918</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74918</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Fri, 04 Mar 2022 17:17:26 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 16:20:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> said in <a href="/post/74915">Replacing variable length file paths in a GEDCOM file</a>:</p>
<blockquote>
<p dir="auto">Your original expression did pick up the total requirement.</p>
</blockquote>
<p dir="auto">I think that might have been blind luck. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74916</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74916</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 04 Mar 2022 16:20:24 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 16:17:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> said in <a href="/post/74910">Replacing variable length file paths in a GEDCOM file</a>:</p>
<blockquote>
<p dir="auto">It’s actually old-spec, though.</p>
</blockquote>
<p dir="auto">True.</p>
<blockquote>
<p dir="auto">It’s actually old-spec, though.  Maybe let’s call it <strong>we</strong>-didn’t-read-spec.</p>
</blockquote>
<p dir="auto">I’m not so sure about that: Your original expression did pick up the total requirement. My “new and improved” one introduced the non-compliance (and my most recent is in essence the same as your original).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74915</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74915</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Fri, 04 Mar 2022 16:17:49 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 15:52:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> said in <a href="/post/74908">Replacing variable length file paths in a GEDCOM file</a>:</p>
<blockquote>
<p dir="auto">Find (?-s)(?&lt;=^\d FILE ).+(?=/)<br />
Replace: /Smith_1234<br />
So replacement text now needs the starting slash.</p>
</blockquote>
<p dir="auto">That’s the one!  And to echo Alan’s last comment, you’ve given me all I asked for and more than enough to be going on with.  I’m good to go now, thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74912</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74912</guid><dc:creator><![CDATA[Web Master]]></dc:creator><pubDate>Fri, 04 Mar 2022 15:52:50 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 15:47:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> said in <a href="/post/74908">Replacing variable length file paths in a GEDCOM file</a>:</p>
<blockquote>
<p dir="auto">New spec says we need to handle both kinds of slash, tilde, and drive letter, so it needs to be more complex than that, right?</p>
</blockquote>
<p dir="auto">Yea.<br />
It’s actually old-spec, though.  Maybe let’s call it we-didn’t-read-spec.<br />
:-)</p>
<p dir="auto">And TBH, my “exactness” tends to fall off the longer these types of threads go on…</p>
<p dir="auto">However, I think we’ve given the OP enough to get his task carried out, so that’s a good thing.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74910</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74910</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 04 Mar 2022 15:47:41 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 15:46:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> Thanks Alan.  I think I need to read a regex primer before I have another read of that explanation.</p>
<p dir="auto">But to go back to my OP and second bullet, the ~ was not the only char to put a spanner in the works.  It’s possibe it could also be:</p>
<p dir="auto">\<br />
Drive letter C: D: etc case insensitive)</p>
<p dir="auto">… and these appear to trip up Neil’s enhanced version <em><strong>(EDIT: Ah, this message crosses with Neil’s latest, where he identifies the same issue)</strong></em></p>
<p dir="auto">But your orginal query handles them all.</p>
<p dir="auto">I think it’s time to be realistic and say that we have solved it and that the effort to make it completely foolproof is perhaps a stretch farther than we NEED to go</p>
<p dir="auto">Meanwhile I’ll go off and explore Python</p>
<p dir="auto">Thank you everyone.  It’s only 24 hours since my initial request for help and you’ve all been fab!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74909</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74909</guid><dc:creator><![CDATA[Web Master]]></dc:creator><pubDate>Fri, 04 Mar 2022 15:46:23 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 15:35:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> said in <a href="/post/74907">Replacing variable length file paths in a GEDCOM file</a>:</p>
<blockquote>
<p dir="auto">~?</p>
</blockquote>
<p dir="auto">New spec says we need to handle both kinds of slash, tilde, and drive letter, so it needs to be more complex than that, right?</p>
<p dir="auto">Annoyingly, since the <em>behind</em> text is now varlen, this demolishes the glory of replace text being pure user-text.</p>
<p dir="auto">Instead of mucking about with all the variations of drive letters and slashes and tildes, I’m gonna propose a looser spec:</p>
<ul>
<li>following &lt;space after “FILE”&gt;, match <em>any</em> run of text, min len 1, until trailing forw slash</li>
</ul>
<p dir="auto">Hence:</p>
<p dir="auto">Find <code>(?-s)(?&lt;=^\d FILE ).+(?=/)</code><br />
Replace: <code>/Smith_1234</code><br />
So replacement text now needs the starting slash.<br />
To keep the user experience elegant, this would be incorp’d into the script:</p>
<pre><code>editor.rereplace(find_regex, '/' + replacement_text)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/74908</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74908</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Fri, 04 Mar 2022 15:35:57 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 14:49:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a></p>
<p dir="auto">Possibly the expression you now want (OK, you wanted it from the start!) is:</p>
<p dir="auto"><code>(?-s)(?&lt;=^\d FILE )~?/.+(?=/)</code></p>
<p dir="auto">BTW, here’s the English explanation of it, for maximum learning:</p>
<ul>
<li><a href="https://www.regular-expressions.info/modifiers.html" rel="nofollow ugc">Use these options for the whole regular expression</a> <code>(?-s)</code>
<ul>
<li><a href="https://www.regular-expressions.info/modifiers.html" rel="nofollow ugc">(hyphen inverts the meaning of the letters that follow)</a> <code>-</code></li>
<li><a href="https://www.regular-expressions.info/modifiers.html" rel="nofollow ugc">Dot doesn’t match line breaks</a> <code>s</code></li>
</ul>
</li>
<li><a href="https://www.regular-expressions.info/lookaround.html" rel="nofollow ugc">Assert that the regex below can be matched ending at this position (positive lookbehind)</a> <code>(?&lt;=^\d FILE )</code>
<ul>
<li><a href="https://www.regular-expressions.info/anchors.html" rel="nofollow ugc">Assert position at the beginning of a line (at beginning of the string or after a line break character) (carriage return and line feed, form feed, next line, line separator, paragraph separator)</a> <code>^</code></li>
<li><a href="https://www.regular-expressions.info/shorthand.html" rel="nofollow ugc">Match a single character that is a “digit” (any decimal number in any Unicode script, plus any symbol with a decimal value in the active code page)</a> <code>\d</code></li>
<li><a href="https://www.regular-expressions.info/characters.html" rel="nofollow ugc">Match the character string “ FILE ” literally (case sensitive)</a> <code>FILE</code></li>
</ul>
</li>
<li><a href="https://www.regular-expressions.info/characters.html" rel="nofollow ugc">Match the character “~” literally</a> <code>~?</code>
<ul>
<li><a href="https://www.regular-expressions.info/optional.html" rel="nofollow ugc">Between zero and one times, as many times as possible, giving back as needed (greedy)</a> <code>?</code></li>
</ul>
</li>
<li><a href="https://www.regular-expressions.info/characters.html" rel="nofollow ugc">Match the character “/” literally</a> <code>/</code></li>
<li><a href="https://www.regular-expressions.info/dot.html" rel="nofollow ugc">Match any single character that is NOT a line break character (line feed, carriage return, form feed, next line, line separator, paragraph separator)</a> <code>.+</code>
<ul>
<li><a href="https://www.regular-expressions.info/repeat.html" rel="nofollow ugc">Between one and unlimited times, as many times as possible, giving back as needed (greedy)</a> <code>+</code></li>
</ul>
</li>
<li><a href="https://www.regular-expressions.info/lookaround.html" rel="nofollow ugc">Assert that the regex below can be matched starting at this position (positive lookahead)</a> <code>(?=/)</code>
<ul>
<li><a href="https://www.regular-expressions.info/characters.html" rel="nofollow ugc">Match the character “/” literally</a> <code>/</code></li>
</ul>
</li>
</ul>
<p dir="auto">Created with <a href="https://www.regexbuddy.com/" rel="nofollow ugc">RegexBuddy</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/74907</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74907</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 04 Mar 2022 14:49:04 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 14:41:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> I shall breakout the sackcloth and ashes. :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74906</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74906</guid><dc:creator><![CDATA[Web Master]]></dc:creator><pubDate>Fri, 04 Mar 2022 14:41:32 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 14:39:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a> said in <a href="/post/74904">Replacing variable length file paths in a GEDCOM file</a>:</p>
<blockquote>
<p dir="auto">I mentioned in my OP - bullet 2</p>
</blockquote>
<p dir="auto">It’s true; you did:</p>
<blockquote>
<p dir="auto">The old file path always starts at char 8 in the string but may be: \ / ~ or a drive letter, so position 8 is the most reliable start point</p>
</blockquote>
<p dir="auto">But everyone missed it. :-)<br />
Because we are more focused on sample data and what it looks like.<br />
I guarantee it wouldn’t have been missed if it was provided as part of the original sample data.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74905</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74905</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 04 Mar 2022 14:39:51 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 14:37:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> I mentioned in my OP - bullet 2</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74904</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74904</guid><dc:creator><![CDATA[Web Master]]></dc:creator><pubDate>Fri, 04 Mar 2022 14:37:31 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 14:37:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a></p>
<p dir="auto">My 30ms reaction to this data:  The <code>~</code> is a new, never mentioned before feature of your data.  Of course the expressions provided before don’t match it.  But you already know this.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74903</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74903</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 04 Mar 2022 14:37:07 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 14:34:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a> OK here are a few lines that are not following Neil’s rule.  Note NONE of the lines in the 4,000 line file were changed.  It said there were zero occurrences.  I copied and pasted the query so it shouldn’t be operator error, but PICNIC problems can’t be ruled out! :)</p>
<pre><code>2 FILE ~/Pictures/Reunion Pictures/Imported Media/HOBDAY, Audrey Lilian.jpg
2 FILE ~/Pictures/Reunion Pictures/Imported Media/HOBDAY, Audrey Lilian - 1.jpg
2 FILE ~/Pictures/Reunion Pictures/Imported Media/HOBDAY, Audrey Lilian - 2.jpg
2 FILE ~/Pictures/Reunion Pictures/Imported Media/Robert Frederic &amp; Audrey Lilian - 3.jpg
2 FILE ~/Pictures/CUMBERLAND BMD/Audrey Cumberland Death Certificate.jpeg
2 FILE ~/Pictures/HOBDAY/Mums School Report.jpg
2 FILE ~/Pictures/CUMBERLAND Parish Registers/Frederick Charles Cumberland Baptism 1901.jpg
2 FILE ~/Pictures/CUMBERLAND BMD/Frederick Cumberland Death 1985.jpeg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0005.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0332.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0370.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0003.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0150.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0014.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0080.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0141.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0172.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0254 (2).jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Dance Programme 1.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Dance Programme 2.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Dance Programme 3.jpg
2 FILE ~/Pictures/CUMBERLAND BMD/Frederick Cumberland Cremation 1985.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Dance Programme 4.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/DSCN0101.jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/DSCN0102.jpg
2 FILE ~/Pictures/CUMBERLAND CENSUS/Frederick Cumberland 1921 Census.jpg
2 FILE ~/Pictures/CUMBERLAND CENSUS/Frederick Cumberland 1921 Census (1).jpg
2 FILE ~/Pictures/CUMBERLAND DAVIS PHOTOS/Cumberland L0108.jpg
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/74902</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74902</guid><dc:creator><![CDATA[Web Master]]></dc:creator><pubDate>Fri, 04 Mar 2022 14:34:01 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 14:27:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> Hi Alan</p>
<p dir="auto">I have to be circumspect about what I put in a public domain because  a GEDCOM file contaions personal; info of living people so there’s a GDPR issue.  But, sure I can cut out some of the lines that are giving trouble and post them here.  One moment…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74900</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74900</guid><dc:creator><![CDATA[Web Master]]></dc:creator><pubDate>Fri, 04 Mar 2022 14:27:38 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 14:17:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a> Does PM mean the chat? Sure go ahead, but I’m not sure if it supports file transfer. Another option is to put file  on a hosting site so we can all access it.</p>
<p dir="auto">An easy thing to do is to gather up at least a few screens worth of “interesting” data (stressful/challenging to the algorithm) and tossing it into a “literal text” box as you’ve already learned to do (I’m not sure of upper size limit). (Here’s a trick: to defeat inappropriate colorization, add <code>txt</code> immediately after the opening line’s triple-backquotes).</p>
<p dir="auto">But over and above all of this, do notice that Alan’s post above provides a solution that is <em>everything you dreamed of</em>. You’ll need to install the Pythonscript plugin and learn a bit about making / saving / running a script (I’ve seen step-by-step recipes; I expect someone will link you to a reliable up-to-date one).</p>
<p dir="auto">Have fun.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74898</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74898</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Fri, 04 Mar 2022 14:17:58 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 14:11:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a></p>
<p dir="auto">Why don’t you just post a line – or a few lines – here that you think it <em>should</em> match, but it isn’t?  That may be more instructive (for those reading along) than taking it offline into some private discussion.</p>
<p dir="auto">While initially impressed with your initiative, I’m now losing faith in your debugging skills. :-(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74896</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74896</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 04 Mar 2022 14:11:47 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 13:58:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> Yes, I copied and pasted the expression direct from here and the file had def not been processed already.</p>
<p dir="auto">I don’t know what the protocol is here.  May I PM you the file so you can try it?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74894</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74894</guid><dc:creator><![CDATA[Web Master]]></dc:creator><pubDate>Fri, 04 Mar 2022 13:58:17 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 12:46:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a> said in <a href="/post/74860">Replacing variable length file paths in a GEDCOM file</a>:</p>
<blockquote>
<p dir="auto">Is there a way to put this into a macro so that at runtime the user is prompted for the replacement string?</p>
</blockquote>
<p dir="auto">As <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> mentioned, not possible with a macro.</p>
<p dir="auto">But as a PythonScript it is rather simple:</p>
<pre><code>replacement_text = notepad.prompt('Replacement text:', '', '')
if replacement_text:
    find_regex = r'(?-s)(?&lt;=^\d FILE /).+(?=/)'
    editor.rereplace(find_regex, replacement_text)
</code></pre>
<p dir="auto">You’d run the script and then get prompted with:</p>
<p dir="auto"><img src="/assets/uploads/files/1646397840905-a7afa474-b454-42b6-82e0-47d305e365b2-image.png" alt="a7afa474-b454-42b6-82e0-47d305e365b2-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">After pressing OK the replacements would be made.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74892</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74892</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 04 Mar 2022 12:46:13 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 12:33:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> said:</p>
<blockquote>
<p dir="auto">you changed (my) original usage of .+ to .*</p>
</blockquote>
<p dir="auto">That’s not how it actually went. I devised my solution independently from reading the OP (deciding early that it should have a look-behind and a look-ahead). Then I saw you had a solution that was satisfactory, and I saw no reason to pipe in.</p>
<p dir="auto">Much later I noticed in the follow-up convo that <a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a> was trying to reduce complexity for his non-technical volunteers, and realized my solution was favorable to that. And it was after <em>that</em> that I realized our solutions also differed in the modifier, and that the asterisk was maybe a bit too loose (although, dollars to doughnuts, they perform equally).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74891</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74891</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Fri, 04 Mar 2022 12:33:44 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 12:17:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a></p>
<p dir="auto">Just to be clear:<br />
Find: <code>(?-s)(?&lt;=^\d FILE /).+(?=/)</code><br />
Replace: <code>Smith_1234</code><br />
Mode=regex; checkbox to the right doesn’t matter anymore</p>
<p dir="auto">Then, <em>Find Next</em> to observe expected matching, <em>Replace</em> to perform the substitution on the currently selected match, <em>Replace All</em> to  perform the substitution on entire file.</p>
<p dir="auto">I have tested this. Are you sure you aren’t acting on a file that has already had the substitutions done?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74888</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74888</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Fri, 04 Mar 2022 12:17:14 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 12:16:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> said in <a href="/post/74885">Replacing variable length file paths in a GEDCOM file</a>:</p>
<blockquote>
<p dir="auto">Also, if you want to make it impossible to match a completely empty path (nothing between two slashes: //), in my Find expression, we’d replace * with +</p>
</blockquote>
<p dir="auto">I’m surprised you changed (my) original usage of <code>.+</code> to <code>.*</code> in your version, then backed it out with “we’d replace * with +”.  :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74887</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74887</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 04 Mar 2022 12:16:12 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 12:05:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> Hi Neil.  OK, that’s what I thought you meant, but when I do that, Find and Replace does nothing</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74886</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74886</guid><dc:creator><![CDATA[Web Master]]></dc:creator><pubDate>Fri, 04 Mar 2022 12:05:52 GMT</pubDate></item><item><title><![CDATA[Reply to Replacing variable length file paths in a GEDCOM file on Fri, 04 Mar 2022 11:06:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/web-master" aria-label="Profile: web-master">@<bdi>web-master</bdi></a> I could have been more clear.</p>
<p dir="auto">The idea is that you perform a Regex search in the same way as the earlier recipe, except the <em>Find</em> expression is the one I offered, and, the <em>Replace</em> expression is simply and completely the text you want to substitute in.</p>
<p dir="auto">Thus, instead of your people having to carefully modify the <em>Replace</em> expression from <code>${1}/Smith_1234/</code> to <code>${1}/Jones_4567/</code> as they proceed from one task to the next, they can more comfortably change <code>Smith_1234</code> to <code>Jones_4567</code> – no funny confusing text in the <em>Replace</em> text box.</p>
<p dir="auto">Also, if you want the solution to be robust against users inadvertently checking that option box to the right of <em>Reg Exp</em>, prefix the <em>Find</em> expression with (?-s) as per Alan’s earlier expression.</p>
<p dir="auto">Also, if you want to make it impossible to match a completely empty path (nothing between two slashes: <code>//</code>), in my <em>Find</em> expression, we’d replace <code>*</code> with <code>+</code>, hence: <code>(?-s)(?&lt;=^\d FILE /).+(?=/)</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/74885</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74885</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Fri, 04 Mar 2022 11:06:49 GMT</pubDate></item></channel></rss>