<?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[Delete text up to a certain number of characters from the end of a line]]></title><description><![CDATA[<p dir="auto">I’ve tried a few different regex strings, but can’t figure out the lookahead part to make this work. I have a few thousand lines of text and am trying to remove the variable number of characters and leave a fixed number of them from the end of the line. Examples:</p>
<p dir="auto">Input:</p>
<p dir="auto">alhsoidoli aoisudoifu oaisoi<br />
iodaoiu a;osidh ;oaiyu ;oisdlhidadsli<br />
LOIHYoihdlhi OIHlohi LOHIOOLhiol oo</p>
<p dir="auto">Output:</p>
<p dir="auto">ifu oaisoi<br />
dlhidadsli<br />
OOLhiol oo</p>
<p dir="auto">So the find criteria would match the last 10 characters from the end and preserve that, deleting the entire rest of the line. I don’t have any special delimiting character I can match on; every line is very different. The only thing I do know is the fixed number of characters from the end of the line. Thanks!</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20297/delete-text-up-to-a-certain-number-of-characters-from-the-end-of-a-line</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 18:22:27 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20297.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Nov 2020 16:35:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Delete text up to a certain number of characters from the end of a line on Thu, 12 Nov 2020 20:14:10 GMT]]></title><description><![CDATA[<p dir="auto">That worked like a champ! Thank you ever so much!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59646</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59646</guid><dc:creator><![CDATA[Keith Wood]]></dc:creator><pubDate>Thu, 12 Nov 2020 20:14:10 GMT</pubDate></item><item><title><![CDATA[Reply to Delete text up to a certain number of characters from the end of a line on Thu, 12 Nov 2020 16:43:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/keith-wood" aria-label="Profile: Keith-Wood">@<bdi>Keith-Wood</bdi></a>,</p>
<p dir="auto">My logic would be “capture from the beginning of the line, as many characters as possible, until a lookahead of 10 characters before the EOL is matched”.  That translates into something like:</p>
<ul>
<li>FIND = <code>^.*(?=.{10}$)</code><br />
REPLACE = empty<br />
MODE = regular expression</li>
</ul>
<p dir="auto">Which worked for me</p>
<pre><code>ifu oaisoi
dlhidadsli
OOLhiol oo
</code></pre>
<p dir="auto">If this doesn’t work for you, you will have to clarify, after reading and taking to heart the following advice:</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 plain 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>. 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/59644</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59644</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 12 Nov 2020 16:43:03 GMT</pubDate></item></channel></rss>