• Appropriate command to change lines using regular expressions

    9
    1 Votes
    9 Posts
    489 Views
    J

    @guy038 I didn’t have the chance to thank you very much for your support! It worked very well!

  • Need help deleting any text between other text

    3
    0 Votes
    3 Posts
    388 Views
    ImgemaI

    Thank you!

  • Delete lines beginning with X to ending with Y

    4
    0 Votes
    4 Posts
    1k Views
    Robert OramR

    Thank you so much for your prompt help! They both work perfectly!

    Bob

  • Underlining links.

    10
    0 Votes
    10 Posts
    710 Views
    Lycan ThropeL

    @rdipardo ,
    Here’s a perfect example, of what I mean. From my Mother in law, I learned to say that backwards, Bardzo dziękuję. Been a while since the course, so I can’t challenge the translator, but that’s the point. :-)
    It’s dependent on the translation and how it’s getting done. ;)

  • Sélectionner le texte marqué / Select marked Text

    18
    0 Votes
    18 Posts
    3k Views
    Denis AdraD

    Hey hi @guy038 , I’m coming back to you

    It’s been a busy day between yesterday and today.

    Thanks for the new information. The method you propose is very interesting. Longer and a little more complicated than @Terry-R 's but in the end safer because it is true that when you finalize, there are no mistakes left. Where it can often remain with a numbering system that by dint of being cut and pasted and even sometimes unexpectedly taken in the selection that will pass to the translation, it happens that it gets mixed with the paragraphs. In the end, the time I save with the numbering system, I often lose later to detect and correct the mistakes. Note, this is entirely my fault because I could have or should have made a selection in columns.

    In order not to let your help and efforts go to waste, I used your method on the 10 or so small files I had left and it works very well. Many thanks to you!

    A huge thank you also to @Terry-R , because his method arrived quite quickly. At a time when I was more than tired of editing a 400k file by hand and wanted to give up more than once!

    Finally, thank you all for all this advice @guy038 @Terry-R @PeterJones . As I said before, I am not an expert in notepad++ at all. I’ve done a degree in computer science 15 years ago, but I’m not at all specialized in programming and I’m doing totally different things today. I found all these little tips very interesting and I’m sure they will be very useful in the future. Thanks again to both of you!

    I’ve completely finished the translation, for the rest I’ll only have to touch up the fonts and make corrections that I would have noticed in game.

  • 0 Votes
    6 Posts
    2k Views
    Mark OlsonM

    I like the solutions proposed above because they are relatively simple and to-the-point. However, regex-replaces on JSON in general get pretty hairy due to factors including but not limited to:

    how do you differentiate between a pattern in a key versus a string? how do you take into account the fact that JSON doesn’t care about the order of keys whereas regexes do? what if there are ] or } inside strings, such that the regex is fooled into thinking the JSON object ended?

    Just to illustrate how annoying regex-replaces get once you start trying to satisfy all the syntactic requirements of JSON, here’s a regex-replace I came up with to achieve this while ignoring insignificant whitespace and the order of keys and removing any trailing commas:
    find/replace (?-i),\s*{(?:[^{]*{[^}]*}\s*,\s*"model"\s*:\s*"[^"]*KeepInfo[^"]*"\s*|\s*"model"\s*:\s*"[^"]*KeepInfo[^"]*"[^{]*{[^}]*}\s*)}\s*(,)? with \1.

    JsonTools is a fine solution for this, if you’re able to use plugins.

    Because it uses a JSON parser to parse the JSON, it is insensitive to the formatting of the JSON.

    To filter JSON with the plugin, just use Alt-P-J-J (tap the keys in sequence, don’t hold them down simultaneously) to open the tree view, then enter one of the following queries into the query box and hit Ctrl+Enter, then Save query result.
    Two queries that accomplish your goals:
    @[:][not(@.model =~ `(?i)keepinfo`)] filters out objects where the model includes keepinfo ignoring case.
    @[:][not(@.model =~ KeepInfo)] filters out objects where the model includes KeepInfo in that case only.

    While I’m here, PythonScript is also an efficient solution:

    import json from Npp import editor j = json.loads(txt) filtered = [o for o in j if 'KeepInfo' in o['model']] filtered_text = json.dumps(filtered, indent=4) editor.setText(filtered_text)
  • Delete entries and unknown amount of brackets

    3
    2 Votes
    3 Posts
    194 Views
    Felix LF

    @Alan-Kilborn You’re just awesome dude, thank you very much. Works like a charm.

  • Comment on FAQ post about 8.5.3 macros

    2
    0 Votes
    2 Posts
    398 Views
    PeterJonesP

    @mkupper ,

    Ugh. Apparently, like backslash-square-brackets, HTML entities are another thing that NodeBB messes up when you edit a post, because it was right when I first posted it. Fixed. (edit: updated the forum-formatting FAQ to call out that oddity with entities, as well)

    Regarding DM: the “chat” feature speech bubble in the upper-right by your icon is the way to do private messages
    d3a7bd64-4296-4f8b-a302-820992061b17-image.png

  • Automate Notepad++ new doc creation

    8
    0 Votes
    8 Posts
    766 Views
    mkupperM

    @Chris-Johnston In reading https://www.autoitscript.com/forum/topic/210204-automate-notepad-new-doc-creation-moved/ it appears that in Notepad++ you want

    Settings / Preferences / New Document (on left sidebar) / Default language to be AutoIt.

    Notepad++ can already do that. What Notepad++ does not seem to have baked in at present is a default blank document template. It’s not clear though
    if filling in the new tab with stuff related to a generic .au3 file is useful or essential to you. Any of what people have already suggested here will do for filling in the default new-document but it’s also possible a plugin exists that can do this.

  • Sort lines but keep the hierarchy

    5
    0 Votes
    5 Posts
    402 Views
    guy038G

    Hi, @rune-egenes and All,

    Easy !

    First regex :

    SEARCH \R(?=\t)

    REPLACE Leave EMPTY

    Sort

    Second regex

    SEARCH (?=\t)

    REPLACE \r\n    or    \n if you deal with UNIX files

    BR

    guy038

  • Notepad++ upgrade issue

    2
    0 Votes
    2 Posts
    211 Views
    Terry RT

    @Abhinav-kganan said in Notepad++ upgrade issue:

    Is there any way I can retrieve it?

    You haven’t exactly provided much information. However I suspect you have been working with tabs of data that you haven’t actually saved as real files. Which if true is a shame, because if you have critical data you really do need to save it.

    How about read this post which is in the FAQ section. In there are references to the periodic backup files created if you have the right settings enabled for those “unsaved” tabs.

    Good luck. Even if you do not recover the data, please read that post entirely, understand what it is saying, and change your backup procedures so you do not suffer the same occurance in the future.

    Terry

  • Help Adding Pascal to Function List

    27
    0 Votes
    27 Posts
    3k Views
    Lycan ThropeL

    @menit-lop ,
    You might want to read the documents a little better. If you’re going to have multiple possibilities in the mainExpr buffer, than you need to give it multiple options by separating the two options, not combining them. It probably should look more like this:

    ?i:PROCEDURE\s+ \K | ?i:FUNCTION\s+ \K

    When the first option fails, it tries the next…and on down a list if there are multiple options, like @PeterJones showed me in my dBASE UDL, which had the similar construct of Procedure, Functions, but also so we could make objects show up in the function list when there was no function, by using an additional OR statement of with, where the code looked like this:

    this.NPPINST_TL = new TEXTLABEL(this) with (this.NPPINST_TL) height = 2.0 left = 29.0 top = 0.5 width = 67.0 text = "Notepad++ dBASE Plus UDL Installer" colorNormal = "0x404000/Silver" fontSize = 19.0 fontBold = true endwith

    As you can see, our UI classes would not show up unless they had a function inside them, and we wanted to be able to see the Objects whether they had a function or not, and @PeterJones figured that out for me, that adding that OR statement in the function parser would allow that to show up also emulating a function option, so our functionList code looked like this:

    <function mainExpr="(?xi-s) ^ \h* (?: function \h+ \w+ | procedure \h+ \w+ | with \h+ \(.*?\) ) \h* " >

    Hopefully this helps you.

  • 0 Votes
    4 Posts
    227 Views
    Mark OlsonM

    My gut feeling is that you should probably be using an XML parser for this sort of thing. I suspect XSLT could be useful, but since I’ve never used it I can’t say more.

    See the XMLTools plugin. Even though it hasn’t been updated recently, it still seems to work fine.

  • OneDrive interactions with Notepad++

    6
    0 Votes
    6 Posts
    4k Views
    Alan KilbornA

    @Demetrio-Foti

    Notepad++'s reload prompt only fires based upon the file timestamp that the OS supplies to Notepad++. So any funkyness regarding onedrive is related to this, not some “local bit” or “status icon”.

    My personal theory about onedrive is that there are many ways it can be configured. Depending on what configuration is set, at different times it can make Notepad++ think that the filetime has changed, thus firing the reload prompt.

  • notepad ++ v8.4.8 exception error when trying to connect NppFTP

    2
    0 Votes
    2 Posts
    210 Views
    Lycan ThropeL

    @aileen-balian
    If it’s not an incompatibility issue (check the Plugins Admin), check with the author at his github page, since this is a plugin.

  • Find and replace by adding a value

    3
    0 Votes
    3 Posts
    292 Views
    David CRD

    ok! Tanks :)

  • append text to some lines only

    5
    1 Votes
    5 Posts
    339 Views
    namx3249N

    yes Alan, i’ve see that !

  • a regex question with new line

    6
    0 Votes
    6 Posts
    986 Views
    Daniel B. 0D

    another option! thanks for this too! :)

  • Page seems to be full of space characters just recently

    2
    0 Votes
    2 Posts
    197 Views
    PeterJonesP

    @Arthur-Hodgett ,

    next line by pressing the down arrow, it automatically returned to the last > on the next line, but now it just goes to the line below as if it was full of space characters

    My guess is that you (intentionally or accidentally) checkmarked the option Settings > Preferences > Editing > ☑ Enable Virtual Space, which allows you to place your cursor beyond the end of the line.

    (In a fresh installation / fresh portable, that option defaults to not being checkmarked, so you or someone else with access to your Notepad++ has turned it on, if I am correct about the culprit)

  • Help with Trimming text-Remove before and after words

    19
    0 Votes
    19 Posts
    2k Views
    guy038G

    Hi, @saltshaker2112, @terry-r, @coises, @mark-olson, @coises and All,

    Ah… OK. But, if we have to be less restritive on the text to keep, we must be more restrictive regarding the text to get rid of ! Thus :

    The part BEFORE the song’s title, which will be deleted, is :

    Any NON-word text followed with a number, followed by anything with a final dash AND, at least, ONE blank char

    Any number, up to three digits, possibly preceded with blank chars and followed with, at least, ONE blank char

    The part AFTER the song’s title, which will be deleted, is :

    At least ONE blank char, followed by any char among ([{<_-, followed by possible space chars, followed with a duration ( \d{1,2}(:)\d{2} ), followed with possible space chars, followed with any char among )]}>_- and finally followed with a combination of blank and new-line chars

    This part, which manages possible line-breaks, is then replaced by a single line-break ONLY

    So, starting with the INPUT text, below :

    01) - Bastille Day 5:19 02. - Lakeside Park [ 4:41 ] [03] - Bytor And The Snowdog 5:43 04 - Xanadu 12:06 05 - A Farewell To Kings ( 6:35 ) Something For Nothing 4:13 ((07 - Cygnus X-1 10:22 01 - Anthem 4:15 02- Closer To The Heart 999 - 3:35 - [03 ] - 2112 18:23 ( 03) - (2112) This Is A Test [2012 ] 18:23 03}} - [ 2112 ] This Is An Other Test 2012 <18:23 > 04 Working Man / Fly By Night / In The Mood / Drum Solo _15:16_ 05 - Cinderella Man 5:14

    Here is my new version of the first regex S/R, which get a clean list of the song’s titles :

    SEARCH (?x) ^ \h* (?: \W* \d+ \W* \h* - | \d{1,3} ) \h+ | \h+ [([{<_-]? \x20* \d{1,2} ( : ) \d{2} \x20* [)]}>_-]? ( \h* \R )+

    REPLACE ?1\r\n

    And you get this OUTPUT text :

    Bastille Day Lakeside Park Bytor And The Snowdog Xanadu A Farewell To Kings Something For Nothing Cygnus X-1 Anthem Closer To The Heart 999 2112 (2112) This Is A Test [2012 ] [ 2112 ] This Is An Other Test 2012 Working Man / Fly By Night / In The Mood / Drum Solo Cinderella Man

    Hope that it’s the expected one !!

    Of course, the second regex, regarding case changes, is the same as in my previous post !

    BR

    guy038

    P.S. Note that the simple lines, below :

    123 789 15:47 00 15:47

    With a song’s title containing less than four digits ONLY, with or without a leading rank, would wongly end up to :

    15:47 03:19

    I chose the limit of three digits, in order that lines with a leading rank up to three digits, immediately followed by the title, as below, are correctly handled ! Indeed :

    456 The most beautiful song of all the times (12:53)

    Would correctly result as :

    The most beautiful song of all the times