• 0 Votes
    4 Posts
    213 Views
    guy038G

    Hi, @john-goewie, @coises and All,

    @coises, I’ve analyzed your method and, really, your method is quicker and more efficient than mine ! However, for more than, let’s say, a dozen of lines to concatenate, I suppose that building the associate regexes would be tedious !

    BTW, I tried a variant of your method which works fine, too :

    In this variant, I prefered to not use the \t separator and included the EOL of groups 8 to 13 within the groups themselves !

    Thus, from this INPUT text :

    mklink /D "E:\Drum LIB\CLAP mklink /D "E:\Drum LIB\HIHAT mklink /D "E:\Drum LIB\KICK mklink /D "E:\Drum LIB\PERCUSSION mklink /D "E:\Drum LIB\CRASH mklink /D "E:\Drum LIB\SNARE mklink /D "E:\Drum LIB\STAB SAMPLECD1 - Techno - Clap SAMPLECD1 - Techno - Hihat SAMPLECD1 - Techno - Kick SAMPLECD1 - Techno - Perc SAMPLECD1 - Techno - Ride SAMPLECD1 - Techno - Snare SAMPLECD1 - Techno - Stab " " " " " " " " " " " " " " H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Clap H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Hihat H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Kick H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Perc H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Ride H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Snare H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Stab " " " " " " "

    The regex S/R is a bit simplified and becomes :

    SEARCH (?-s)^(.*)\R(.*)\R(.*)\R(.*)\R(.*)\R(.*)\R(.*)\R(.*\R)(.*\R)(.*\R)(.*\R)(.*\R)(.*\R)(.*)

    REPLACE $1$8$2$9$3$10$4$11$5$12$6$13$7$14

    and, after 3 clicks on the Replace All button, we get :

    mklink /D "E:\Drum LIB\CLAPSAMPLECD1 - Techno - Clap" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Clap" mklink /D "E:\Drum LIB\HIHATSAMPLECD1 - Techno - Hihat" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Hihat" mklink /D "E:\Drum LIB\KICKSAMPLECD1 - Techno - Kick" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Kick" mklink /D "E:\Drum LIB\PERCUSSIONSAMPLECD1 - Techno - Perc" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Perc" mklink /D "E:\Drum LIB\CRASHSAMPLECD1 - Techno - Ride" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Ride" mklink /D "E:\Drum LIB\SNARESAMPLECD1 - Techno - Snare" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Snare" mklink /D "E:\Drum LIB\STABSAMPLECD1 - Techno - Stab" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Stab"

    Then, the simple S/R, below, adds the missing \ character, right before the first SAMPLECD1 string

    SEARCH (?-i)[^\\](?=SAMPLECD1)

    REPLACE $0\\

    Giving the expected OUTPUT text :

    mklink /D "E:\Drum LIB\CLAP\SAMPLECD1 - Techno - Clap" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Clap" mklink /D "E:\Drum LIB\HIHAT\SAMPLECD1 - Techno - Hihat" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Hihat" mklink /D "E:\Drum LIB\KICK\SAMPLECD1 - Techno - Kick" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Kick" mklink /D "E:\Drum LIB\PERCUSSION\SAMPLECD1 - Techno - Perc" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Perc" mklink /D "E:\Drum LIB\CRASH\SAMPLECD1 - Techno - Ride" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Ride" mklink /D "E:\Drum LIB\SNARE\SAMPLECD1 - Techno - Snare" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Snare" mklink /D "E:\Drum LIB\STAB\SAMPLECD1 - Techno - Stab" "H:\SAMPLEBASE\SAMPLECD1 - Techno\SAMPLECD1 - Techno - Stab"

    BR

    guy038

  • Replace the space between 2 numbers with a slash

    6
    1 Votes
    6 Posts
    597 Views
    Thomas KlinghanT

    @Terry-R nice, it works, thanks :-)

  • Extracting text between two strings

    3
    0 Votes
    3 Posts
    667 Views
    Sanjeev SharmaS

    Thanks. It helped. :)

  • Notepad++ window flies between different monitors constantly

    3
    0 Votes
    3 Posts
    170 Views
    mkupperM

    @Nessa-Carson That seems like a mouse and or keyboard issue.

    An HP Spectre is a laptop that has a single monitor. Do you have a second monitor attached? Do you have an external mouse and or keyboard attached? Does your machine have one of those flat pad mice in front of the keyboard?

    If you have the flat pad mouse thing in front of the keyboard then plug an external mouse and external keyboard into the machine and try Notepad++ with those. The flat pad mouse things are notorious for causing issues as people touch them accidentally when using the keyboard.

    If you are using an external keyboard and mouse then unplug both and see if Notepad++ has issues using the mouse and keyboard built into the laptop.

  • HELP HOW TO INSERT text into blank lines with macro

    9
    0 Votes
    9 Posts
    451 Views
    Steve TrevellaS

    @Alan-Kilborn said in HELP HOW TO INSERT text into blank lines with macro:

    $0M50

    HI THANKYOU.
    I CAN MAKE THAT WORK!!
    MUCH APPRECIATED

  • 0 Votes
    5 Posts
    274 Views
    Terry RT

    @venkanna-gajjala

    I think the regular expression below seems to work well enough.

    Using the Replace function with search mode set to regular expression we have:
    Find What:[^\d]+
    Replace With:\r\n

    Like @mkupper solution it will also require a second step of removing the duplicate lines.

    Terry

    PS it does leave an initial empty line, which I don’t think causes any problems and is easily removed as a final step.

  • 0 Votes
    2 Posts
    232 Views
    PeterJonesP

    @greg-greg

    If you want help with a search/replace problem, you need to give us more to go on than that. Best practice is to include a half-dozen to a couple-dozen lines of example “before” and “after” text (using the </> button to put them in text boxes) – make sure if there’s sensitive/confidential info that you use dummy data that looks like the original (formatted the same, same combos of numbers vs letters, etc) but doesn’t reveal your secrets. Also make sure that your examples show some things that should match and some that don’t.

    See the Template for Search/Replace Questions, linked below, for more of how to ask such questions.

    ----

    Useful References Please Read Before Posting Template for Search/Replace Questions Formatting Forum Posts Notepad++ Online User Manual: Searching/Regex FAQ: Where to find other regular expressions (regex) documentation
  • 0 Votes
    5 Posts
    257 Views
    gamophyteG

    This takes me far and beyond and away further than I was before, thanks!!

    Because even now you can use that front loaded dot as an anchor to do way more, like clean it up if no container (section) encapsulating it, and if there is I can S&R to put it on the front - even if it’s done by selecting at a time.

    You’ve taken it far enough, thanks for your work!!

  • PHP instead <?php and php> {PHP} and {/PHP}

    7
    1 Votes
    7 Posts
    404 Views
    S

    @Ekopalypse
    Thank you for your help! what a pitty. (right now it is easier to just copy the code in between the working <php …)

  • Macros in v8.5.2 warning

    Locked
    3
    0 Votes
    3 Posts
    230 Views
    Mr-BrunesM

    @mkupper Tx for the alert - I’ve no idea what happened there. Feel free to delete this topic.

  • Macro warning message on upgrade

    5
    0 Votes
    5 Posts
    517 Views
    Mr-BrunesM

    @PeterJones

    Ok apols for late reply to your original request on how the warning could be rewritten.

    Some background - I used to work as a field sales tech consultant for a tier 1 global data storage manufacturer and so was well versed in getting beaten up on engagements, nearly always for things that I wasn’t directly responsible for, but hey you’re there and folks want to unload, and often with justification. We often ended up rewriting all sorts of customer docs, but also shipped cases of European beer for the devs.

    It’s especially hard if you’re involved with data security or content creation, since any issues impact productivity in terms of wasted time and worst of all, potential loss of content or even the fear of the latter.

    Other than the golden rule of Don’t Break Stuff, (and if you must then prepare everyone by explaining the heck out of it) the general themes were to consider your audience and the impact for all of them e.g.
    Who – are the affected users
    What – is the change
    Why – is the change req’d
    When - is the impact
    Where - can you go for more info and on how to roll-back.

    I’m sure folks will say this is all overkill, and it would be for a crappy new app that didn’t create content, but that isn’t the case here, and so there are expectations! 😉 Ok time to stop rambling.

    On this particular change, I fell at the first fence i.e. I had no idea whether I was affected. Only a fool would conclude that they would not be affected if they didn’t understand the warning!

    Now I see your reply is updated, so thanks for considering the issue! :-)

  • 0 Votes
    15 Posts
    2k Views
    Xuân-Thơ HOÀNGX

    @mpheath
    Thanks!
    Checked! These fixes are included in version 8.6.6 (currently in the RC2 phase).

  • Remove lines between pasted content?

    2
    0 Votes
    2 Posts
    201 Views
    mkupperM

    @X88R88 said in Remove lines between pasted content?:

    Whats a way or a plugin to allow me to remove lines between pasted note content.

    Take a look at the “Replacing in a specific zone of text” part of FAQ: Generic Regular Expression (regex) Formulas

  • Lua: cannot add additional styles

    8
    1 Votes
    8 Posts
    366 Views
    PeterJonesP

    @Thaoky , @mpheath ,

    Thanks for confirming.

    I submitted PR 15088

  • DirectWrite enabled by default since v8.6

    4
    3 Votes
    4 Posts
    769 Views
    PeterJonesP

    @mkupper ,

    by default for new installations of Notepad++

    That is what “default” means in the User Manual. I am not going to change every single mention of the word “default” to give the caveat, because there are a lot [citation needed] of default settings in the Manual.

  • How to delete all lines found in another txt document

    13
    0 Votes
    13 Posts
    3k Views
    PeterJonesP

    @DimakSerpg ,

    REGEX IN NOTEPAD++ IS THE WRONG TOOL FOR THIS JOB!

    I created three sets of files:

    100,000 7-digit numbers in each, where it will delete about 1/3 of the ones from source.txt 1,000,000 7-digit numbers in each, where it will delete about 1/2 of the ones from source.txt 10,000,000 9-digit numbers in each, where it will delete about 1/3 of the ones from source.txt

    I started notepad++ -nosession -multiInst -noPlugin src1e5.txt del1e5.txt running on the regex for the smallest of those.
    Then in another Notepad++ session, I spend about 10minutes coding up a script in Perl, and made sure it worked on the 100,000 line file in under a second. It then worked on the 1,000,000 line file in about 4 seconds. And then it processed the 10,000,000 line file in 4 minutes.

    I then wrote up this post. By the time I was done with that, it still hadn’t finished running the regex in Notepad++.

    IyFwZXJsDQp1c2UgNS4wMTI7DQp1c2Ugd2FybmluZ3M7DQp1c2Ugc3RyaWN0Ow0KdXNlIFRpbWU6OkhpUmVzIHF3L3RpbWUvOw0KDQpwcmludCBTVERFUlIgc2NhbGFyIHRpbWUsICJcbiI7DQpteSBAc3JjID0gZG8geyBvcGVuIG15ICRmaCwgJzwnLCAnc3JjMWU3LnR4dCc7IDwkZmg+IH07DQpteSBAZGVsID0gZG8geyBvcGVuIG15ICRmaCwgJzwnLCAnZGVsMWU3LnR4dCc7IDwkZmg+IH07DQpteSAlaDsgQGh7QGRlbH0gPSBAZGVsOw0Kb3BlbiBteSAkZmgsICc+JywgJ291dDFlNy50eHQnOw0Kc2VsZWN0ICRmaDsNCiRcID0gIiI7DQpwcmludCBmb3IgZ3JlcCB7IWV4aXN0cyAkaHskX319IEBzcmM7DQpwcmludCBTVERFUlIgc2NhbGFyIHRpbWUsICJcbiI7DQo

    If you can figure out how to decode that text box using Notepad++, and run a perl script (not in Notepad++), it’s yours, for free, no tech support provided. Good luck,

  • Keyboard combo hosed config - how to recover

    4
    0 Votes
    4 Posts
    272 Views
    PeterJonesP

    @Mr-Brunes said in Keyboard combo hosed config - how to recover:

    The Q&A that I didn’t understand was https://community.notepad-plus-plus.org/topic/20992/disable-all-notepad-keyboard-shortcuts?_=1714585277224 and I had no idea what Macro Express is nor how it affects NPP.

    I had never heard of it when that person asked about its interface with Notepad++, either. It’s just some external application which sounded to me like it was similar to AutoHot Key in its behavior.

  • Change or match background and font themes on plugins?

    2
    0 Votes
    2 Posts
    156 Views
    EkopalypseE

    @X88R88

    As a general option? No.
    Npp itself tries its best to make the background and foreground color match, but fonts … not yet. A plugin author has to do that himself.

  • Adding Lines to text In Bulk

    2
    0 Votes
    2 Posts
    222 Views
    Mark OlsonM

    @Cansu-Bal
    If all you wanted to do was insert some text (which is fixed, and doesn’t depend on any properties of the file) followed by a newline at the beginning of a file, you can do that using the Find/replace form, Find in files tab:
    Find what: (?s)[^\r\n]*(\R)?.*
    Replace with: some text(?1${1}:\r\n)${0}
    Filter: *.txt (restrict to .txt files)
    Directory: whatever directory you want to edit files in
    In all subfolders: check if you want to edit all files in a directory’s tree, rather than just direct children of that directory.

    If you’re new to this kind of thing, let me emphasize that you should always Always ALWAYS backup your files before doing a bulk find/replace.

    Note that if you run this on a file with no newlines, it will insert a CRLF newline (\r\n in regular expressions) after some text. Otherwise, it will use the first newline found in the file.

    If you want to do a find/replace operation on a file that uses the name of the file, you could use a plugin, but since you are doing this on a large number of files, this is a job for other tools, not for Notepad++.

  • Display duplicate file names

    3
    0 Votes
    3 Posts
    287 Views
    RedBlue WriterR

    @PeterJones Thank you for your comments and time.

    ‘Update 2’ seems to be like that. The OS on my PC is Win 10 (64-bit). I code with ‘Notepad++’ on my PC. In this state, problems seem to occur when I run ‘Virtual Box’ and code and compile with ‘Microsoft Visual C++ 6.0’ on Win 7 (32-bit) or Win XP.

    I’d like to tell you what I just tested. Each time I save a file on VC++6.0 of Virtual Box, Notepad++ displays the same file name as many times as it has been saved.