• Possible bug - very long line

    5
  • How to remove text between word and symbol using Notepad++?

    2
    0 Votes
    2 Posts
    969 Views
    PeterJonesP

    @Martin-Zanolli :

    Thanks for showing what you tried. That helps.

    The regex you chose selected nothing (rather than everything) for me. That’s because the data as posted does not have a newline sequence before the </text>, which your \R</text> requires.

    You don’t actually need any of the stuff to the right of the </text>, because you appear to be leaving that alone.

    There are many ways to do what you want: you could use fancy lookahead sequences, or you could capture the </text> into a numbered or named group. But the easiest to explain is:

    FIND = (?s-i)^Source: .+?</text> => match case, dot matches newline, match beginning of line, Source: , then at least one character up to the first </text> encountered REPLACE = </text> MODE = regular expression Source: Example Book's Louie p. 165</text><weight>45.0 Source: Example Magazine(s Martin p. 120</text><weight>30.0 Source: Example Droid's Paul p. 165</text><weight>20.0

    becomes

    </text><weight>45.0 </text><weight>30.0 </text><weight>20.0

    The same regex will work if there is a newline, like:

    Source: Example Book's Louie p. 165 </text><weight>45.0 Source: Example Magazine(s Martin p. 120 </text><weight>30.0 Source: Example Droid's Paul p. 165 </text><weight>20.0

    … because the .+? includes newlines thanks to (?s-i)

    If that’s not the results you wanted, or not the data you had, please read the advice below, and reply appropriately

    -----

    Please Read And Understand This

    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:

    This forum is formatted using Markdown. Fortunately, it has a formatting toolbar above the edit window, and a preview window to the right; make use of those. The </> 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 @Scott-Sumner’s post in the “how to markdown code on this forum” topic, and my updates near the end.) 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 need to properly format it.

    If you have further search-and-replace (“matching”, “marking”, “bookmarking”, regular expression, “regex”) needs, study the official Notepad++ searching using regular-expressions docs, as well as this forum’s FAQ 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.

    Please note that for all regex and related queries, it is best if you are explicit about what needs to match, and what shouldn’t match, and have multiple examples of both in your example dataset. Often, what shouldn’t match helps define the regular expression as much or more than what should match.

    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):

    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.
    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 need to be in a group, though sometimes I put it in a numbered (___) or unnumbered (?:___) 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.
    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.
    try it, debug, iterate.
  • Insert xml row

    5
    0 Votes
    5 Posts
    614 Views
    TJ DruidT

    @guy038 Thank you so much. I ended up using your second suggestion. I ran into an issue because my validator did not like the new row between PlanDetail and CustomProperties, but I was able to take what you provided and put the row after CustomProperties instead. I was helping a coworker with a temporary work around and she thanks you too! Happy Holidays, I’m sure Santa will give you something good in your stocking - or at least some good Karma!

  • Encoding (what determinates, plus can't change)

    1
    0 Votes
    1 Posts
    225 Views
    No one has replied
  • Tab indents replaced by spaces, ignores setting

    6
    0 Votes
    6 Posts
    4k Views
    tmschoegjeT

    @PeterJones
    Thanks! I didn’t realise Python was not using the default values

  • My problem in latest version notepad ++ x64 bit

    3
    0 Votes
    3 Posts
    366 Views
    michalsky394M

    @PeterJones
    Thank you for your help. Your solution works. Best regards and have a nice day / evening;)

  • 0 Votes
    4 Posts
    374 Views
    Fantomas Is The BestF

    @John. Fr

  • RegEx help needed

    8
    1 Votes
    8 Posts
    678 Views
    guy038G

    Hello, @hans-dampf, @Alan-kilborn @andrecool-68 and All,

    @hans-dampf, I strongly advice you to study the regexes’s world , beginning with the excellent tutorial of the Regular-Expressions.info site, below :

    https://www.regular-expressions.info/tutorialcnt.html

    It will certainly take you a few weeks to get an overview of the syntax of regular expressions, but it’s really worth it. ;-))

    If you are in a hurry, see this part :

    https://www.regular-expressions.info/shorthand.html

    Moreover, regarding your second regex construction (?<=text":")*(","), this syntax seems incorrect as the quantifier *, meaning repeated 0 or more times should be, either, preceded with a character, like s*, an expression embedded with parentheses like (123)*, a character class, like [abc]* or a shorthand class, like \h*. But, it should not follow a look-behind construction !

    However, I was really surprised that our Boost regex engine does not consider it as invalid !?

    To explain this behavior, let us, first, consider the simple regex (?<=abc)def which searches for the string def only if  preceded with the string abc. If you add the same look-behind, giving the regex (?<=abc)(?<=abc)def it will do the same search, because look-arounds are just zero-length assertions and because they both refer about the same condition !

    You could add as many identical look-behind to get the same result ( For instance (?<=abc)(?<=abc)(?<=abc)(?<=abc)(?<=abc)def would match any string def, if preceded with the string abc ! )

    Indeed, the *, right after the look-behind, is taken as a real quantifier. As consecutive values are useless, the unique interesting case seems to be (?<=abc)?def which would search for the string def OR for the string def only if  preceded with the string abc. Of course, due to Boole algebra, this regex could just be simplified as the search of def ;-))

    To be convinced you of that fact, consider the text, below :

    1 "," 2 text":""," 3 ABCD":"","

    The regexes "," or (?<=text":")*"," or (?<=text":")?"," would find the string ",", in the three lines

    The regexes (?<=text":")"," or (?<=text":")+"," or (?<=text":"){1}"," or (?<=text":"){10}"," would find the string "," in line 2 only

    Best Regards,

    guy038

  • Find in Files missing results since 7.7

    3
    0 Votes
    3 Posts
    283 Views
    magic144M

    @guy038 Thank you so much for the detail and the confirmation :)

  • 0 Votes
    5 Posts
    369 Views
    Joerg HinzJ

    Will get some more of it tomorrow. If it helps you helping me, what more could I ask for? ;)

  • Easier Rollback for edits

    18
    0 Votes
    18 Posts
    964 Views
    Michael VincentM

    @Moon-Watcher said in Easier Rollback for edits:

    Where do I send the check beer?

    Your welcome.

  • Renaming multiple names?

    5
    0 Votes
    5 Posts
    547 Views
    guy038G

    Hello, @ozzy-neil, @Ekopalypse, @alan-kilborn and All,

    From that link, below, giving the general structure of the JSON language :

    https://www.json.org/json-en.html

    Here is a work-around, using a regex S/R :

    First, at the very end of your JSON file, add this new JSON object, below : { "Steven Kourepenos": "Mark Skaife", "Jeff Rubin": "Russell Ingall", "Jaime Baker": "Craig Lowndes", }

    Note that the different couples Old names: New names, added, are not necessarily, listed in the same order than in the file itself. Luckily, it does not matter ;-))

    Now, open the Replace dialog ( Ctrl + H )

    SEARCH (?-s)("driverName":\x20)(".+?")(?=(?s:.+)^\2\h*:\h*(".+"))|(?s)\{[^{}]+\}\Z

    REPLACE \1\3

    Tick the Match case option, if necessary

    Tick the Wrap around option

    Select the Regular expression search mode

    Click once on the Replace All button ( or several times on the Replace button )

    So, assuming the original JSON test, with the new object containing all the couples of names, at the very end :

    { "drivers": [ { "driverName": "Jaime Baker", "carDesign": "21,fa7fed,000000,ffffff,fa7fed", "carNumber": "1", "suitDesign": "1,fa7fed,000000,ffffff", "helmetDesign": "1,fa7fed,000000,ffffff", "carPath": "mx5\mx52016", }, { "driverName": "Steven Kourepenos", "carDesign": "0,111111,cccccc,ed1c24", "carNumber": "2", "suitDesign": "13,111111,cccccc,ed1c24", "helmetDesign": "63,111111,cccccc,ed1c24", "carPath": "mx5\mx52016", }, { "driverName": "Jeff Rubin", "carDesign": "9,ffffff,1a4b9b,dff000", "carNumber": "3", "suitDesign": "23,ffffff,1a4b9b,dff000", "helmetDesign": "35,ffffff,1a4b9b,dff000", "carPath": "mx5\mx52016", }, ... ... ... ... ... { "Steven Kourepenos": "Mark Skaife", "Jeff Rubin": "Russell Ingall", "Jaime Baker": "Craig Lowndes", }

    After clicking on the Replace All button, you should get the expected file :

    { "drivers": [ { "driverName": "Craig Lowndes", "carDesign": "21,fa7fed,000000,ffffff,fa7fed", "carNumber": "1", "suitDesign": "1,fa7fed,000000,ffffff", "helmetDesign": "1,fa7fed,000000,ffffff", "carPath": "mx5\mx52016", }, { "driverName": "Mark Skaife", "carDesign": "0,111111,cccccc,ed1c24", "carNumber": "2", "suitDesign": "13,111111,cccccc,ed1c24", "helmetDesign": "63,111111,cccccc,ed1c24", "carPath": "mx5\mx52016", }, { "driverName": "Russell Ingall", "carDesign": "9,ffffff,1a4b9b,dff000", "carNumber": "3", "suitDesign": "23,ffffff,1a4b9b,dff000", "helmetDesign": "35,ffffff,1a4b9b,dff000", "carPath": "mx5\mx52016", }, ... ... ... ... ...

    If this S/R does the job, I’ll tell you, next time, how this regular expression works… !

    Best Regards,

    guy038

  • File "doesn't exist. Create it?" wrong extension when opening file

    4
    0 Votes
    4 Posts
    1k Views
    Alan KilbornA

    @PeterJones said in File "doesn't exist. Create it?" wrong extension when opening file:

    the old-style dialog is just evil

    LOL

    In my posting with the screenshots above, I also had the new-style-dialog setting unticked.

  • Find Across Files - Need Better support for Results Pane

    9
    0 Votes
    9 Posts
    762 Views
    PeterJonesP

    @MarkB-Dansko said in Find Across Files - Need Better support for Results Pane:

    Ok, how do I remove ALL PLUGINS from an NP++ install?

    Three easiest ways:

    use the -noPlugin command line argument, or close Notepad++, rename c:\program files\Notepad++\plugins folder to something else, then restart Notepad++ download a fresh .zip version of Notepad++ and unzip into separate directory, and run that copy as a “portable” Notepad++, which will have only default plugins installed

    If you find it works right without plugins, then you can do a search by renaming individual subfolders of c:\program files\Notepad++\plugins – if the folder name doesn’t match the name of the DLL inside, it won’t load that plugin. (So, for example, c:\program files\Notepad++\plugins\pythonscript could be renamed to c:\program files\Notepad++\plugins\x-pythonscript temporarily to disable the PythonScript plugin.

  • How do you revert command symbols (e.g. NUL) to actual characters?

    8
    0 Votes
    8 Posts
    6k Views
    PeterJonesP

    @DeeFeeCee said in How do you revert command symbols (e.g. NUL) to actual characters?:

    If you want I can send you a video

    Many users have problems with the HexEditor plugin (though some others use it successfully). I don’t know that we need a video to prove that.

    It also seems like the characters from x80–x9F are also rendered as their “replacement” characters

    x00-x1F and x7F-x9F are defined in the Unicode standard as control characters, which is why they are rendered as their “replacement” characters.

    Ÿ is the hex representation for 9F, but the character Ÿ itself is… looking it up U+0178

    In some of the ANSI-style 8-bit encodings, Ÿ was at codepoint 159 (x9F). In Unicode, Ÿ is U+0178.

    Your code looks like it might work, I just don’t have time today to try it out.

    Hope it works for you. If it does, and you are able to do animated screenshot, that would be great to share

    I really liked the animation, too!

    I use screentogif.exe, which is free and really easy to use.

  • View>Function List python functions showing up outside of tree

    4
    0 Votes
    4 Posts
    802 Views
    MegMMM

    Wow, so I just tried deleting all the comments that were left and when I deleted

    ### Keep

    and saved, it repositioned the methods correctly. So I’m not sure if that’s a bug or intentional. Can anyone explain? Thank you!

  • Suggestion-A tool to change the program icon

    13
    0 Votes
    13 Posts
    687 Views
    PeterJonesP

    My question for @Emmad-Kareem would be: what other apps that you use do provide such a feature?

    Have you asked the Excel developers to allow you to choose what icon you associate with spreadsheets? Do you expect IE/Edge/Chrome/Firefox/Opera to give you the option to choose a different icon for html files on your computer? Do you expect [insert your music-listening program here] to allow you change the icon for music files associated with that program?

    I have wracked my brain over all the different types of files I regularly use with default associations, and cannot come up with any type where my preferred application allows me to choose any icon I want for files they handle. If you know of any, I would be curious.

    Instead, in my experience, the general philosophy is, “if you want our program to be the default for a filetype: great, we’ll automatically choose an icon for you. If you don’t like that icon, it’s up to you, using the already-existing registry tools built into the OS (or any other third-party registry-editing tool you so desire) to do the change; you’re allowed to do it, but we’re not going to spend our time to do it for you”.

    (re: third party registry tools: nirsoft has the FileTypesManager, which can be used to manage all sorts of things to do with the verbs/actions and icons and programs associated with various file types / extensions)

  • Update Error - Unsupported 16-Bit Application

    3
    0 Votes
    3 Posts
    610 Views
    Alan KilbornA

    @Ekopalypse said in Update Error - Unsupported 16-Bit Application:

    the second r

    Gotta be a typo; the OP must have retyped the contents of a message box, and got it wrong. BTW, I’ve noticed that a lot of the message boxes in N++ have a hidden ctrl+c copy capability. Probably the the OP’s message box wasn’t one of these.

  • Updating Notepad++ Using Zip File

    13
    1 Votes
    13 Posts
    4k Views
    PeterJonesP

    @Loren-Schoepke said in Updating Notepad++ Using Zip File:

    Didn’t have a “Notepad++” folder". Not sure, but I think this gets created if you do an install. I just used ZIP file.

    You are correct. By default, an installer-version will use %AppData%\Notepad++ for storing configuration files and a zip (“portable”) version will just use the zip directory (because that’s part of what makes it “portable”).

    If you would like to maintain a separate %AppData%\Notepad++ but use the zip version, you can delete the doLocalConf.xml from the Notepad+±unzip directory; after that, the next time you run Notepad++, the %AppData%\Notepad++ folder will be created and populated; however, it might* not use the same settings that were in your zipfolder before. (*: caveat = I’ve only tried the deletion of doLocalConf.xml to auto-populate %AppData%\Notepad++ once, and wasn’t specifically looking for this feature, so I didn’t store it in long-term memory; I know it created the folder properly; my memory says that it used default config files, not copies of what’s in your zipfolder, but I could be wrong.)

  • Remove/Replace everything between two strings?

    5
    0 Votes
    5 Posts
    3k Views
    Matthew KampffM

    THANK YOU. Worked perfect. Thank you thank you