• How to move copy and replace some text ?

    4
    0 Votes
    4 Posts
    247 Views
    EkopalypseE

    @PeterJones

    Thanks, but that’s weird because I tried just dragging and dropping it because I was sure that would work, and I’m pretty sure it did in the past, but it hadn’t worked again, so I used imgur … hmm … was I hallucinating?

  • 1 Votes
    5 Posts
    985 Views
    guy038G

    Hello, @francesco-vespari, @mkupper, @peterjones and all,

    Here is my alternate solution :

    SEARCH (?-is)^(?:(?!data).)+\R|(?:(?!data).)+|(database\.schema\.[A-Za-z]{3}[0-9]{3})

    REPLACE ?1$1

    This solution keeps any empty line which already exists in the present text :

    So, for example, given this INPUT text :

    SELECT * FROM database.schema.ABC123 INNER JOIN database.schema.def456 on id1 = id2 LEFT JOIN database.schema.ghi789 on id2 = id3 WHERE 1=1 SELECT * FROM database.schema.ABC123 INNER JOIN database.schema.def456 on id1 = id2 LEFT JOIN database.schema.ghi789 on id2 = id3 WHERE 1=1 SELECT * FROM database.schema.ABC123 INNER JOIN database.schema.def456 on id1 = id2 LEFT JOIN database.schema.ghi789 on id2 = id3 WHERE 1=1

    we would get this OUTPUT one :

    database.schema.ABC123 database.schema.def456 database.schema.ghi789 database.schema.ABC123 database.schema.def456 database.schema.ghi789 database.schema.ABC123 database.schema.def456 database.schema.ghi789

    Notes :

    The first part of the search regex, after the modifiers (?-is) is ^(?:(?!data).)+\R which matches any complete line, with its line-break, ONLY IF it does NOT contain the string data, with this case, at any position of current line

    The second alternative (?:(?!data).)+ matches any part of line, which does NOT contain the string data, with this case

    Until now, just note that no group has been defined because of the two non-capturing syntaxes (?:...

    Finally, the third alternative is the string that we want to keep, i.e. the string (database\.schema\.[A-Za-z]{3}[0-9]{3}), with this exact case, which is stored as group 1

    As we use a conditional replacement ?1$1, which means : ONLY rewrite the group 1 if this group is defined, we are just left with the expected text !

    Best Regards,

    guy038

  • Open with Notepad++

    2
    0 Votes
    2 Posts
    135 Views
    PeterJonesP

    @Kevin-Burton ,

    In general, it shouldn’t go away, unless something weird happened (or maybe you upgraded your OS).

    Reinstall might work. And the User Manual has a whole page on the right-click “Edit with Notepad++” at https://npp-user-manual.org/docs/shell-extension/ – so you should read that page if the reinstall doesn’t solve it for you.

  • not able to see the search results windows in notepad++

    Locked
    35
    1 Votes
    35 Posts
    87k Views
    PeterJonesP
    Locking This Thread

    This issue has come up multiple times. To keep the discussion in one place, please read the v8.7 Search Results section of the missing-panel FAQ, and then continue any discussion in the v8.7 Search Results Missing topic.

  • v8.7 search results window not showing

    Locked
    11
    0 Votes
    11 Posts
    842 Views
    PeterJonesP
    Locking This Thread

    This issue has come up multiple times. To keep the discussion in one place, please read the v8.7 Search Results section of the missing-panel FAQ, and then continue any discussion in the v8.7 Search Results Missing topic.

  • Yet Another Selection Colours Question?

    9
    0 Votes
    9 Posts
    498 Views
    guy038G

    Hello, @penskeguy, @peterjones and All,

    Five years ago, I wrote the post, below, to @dinkumoil, where I asked him about some hints, advices and possible improvements. May be, you’ll be interested by some parts of my post :-)

    https://community.notepad-plus-plus.org/topic/18214/new-plugin-extsettings/32

    At this time, the Selection text color setting did not exist ( BTW, I confirm your findings about this specific setting, whether the ExtSettings dialog is opened or not : it does trigger the text color to the chosen one, only when you click on the Close button or hit the ESC key ! )

    From this post, I also extracted the part regarding the Selection Alpha setting, that I reproduced and completed which should be of some interest for you !

    If we consider, in RGB mode :

    The default current text foreground color (0,0,0)

    The default current text background (255,255,255)

    The default selection color (192,192,192)

    The default current line background color (232,232,255)

    Then, the alpha option allows you to change, BOTH, the color of background and foreground ( text ) of the resulting selection, according to the two general formulas :

    • RESULTING Selection Background = α × SELECTION Background + ( 1 - α ) × CURRENT Background with α in range [0,1] • RESULTING Selection Foreground = α × SELECTION Foreground + ( 1 - α ) × CURRENT Foreground with α in range [0,1]

    In other words, with an α transparency, transposed in range [0-255], we get :

    Resulting Bg Red = ( α × 192 + ( 255 - α ) × 255 ) / 255 for part of selection NOT in CURRENT line ¯¯¯ Resulting Bg Green = ( α × 192 + ( 255 - α ) × 255 ) / 255 for part of selection NOT in CURRENT line ¯¯¯ Resulting Bg Blue = ( α × 192 + ( 255 - α ) × 255 ) / 255 for part of selection NOT in CURRENT line ¯¯¯ Resulting Bg Red = ( α × 192 + ( 255 - α ) × 232 ) / 255 for part of selection within CURRENT line ¯¯¯¯¯¯ Resulting Bg Green = ( α × 192 + ( 255 - α ) × 232 ) / 255 for part of selection within CURRENT line ¯¯¯¯¯¯ Resulting Bg Blue = ( α × 192 + ( 255 - α ) × 255 ) / 255 for part of selection within CURRENT line ¯¯¯¯¯¯ And : Resulting Fg Red = ( α × 192 + ( 255 - α ) × 0 ) / 255 = α × 192 / 255 WHATEVER the location of the SELECTION ¯¯¯¯¯¯¯¯ Resulting Fg Green = ( α × 192 + ( 255 - α ) × 0 ) / 255 = α × 192 / 255 WHATEVER the location of the SELECTION ¯¯¯¯¯¯¯¯ Resulting Fg Blue = ( α × 192 + ( 255 - α ) × 0 ) / 255 = α × 192 / 255 WHATEVER the location of the SELECTION ¯¯¯¯¯¯¯¯

    As α value increases towards 255, the gray colors of selected text and the background converge, reducing contrast between them and, when α = 255, color of Fg = color of Bg = (192,192,192), leading to an invisible selected text !!

    On the contrary, as α value decreases towards 0, the selection background becomes more and more transparent and, when α = 0, color of Fg = (0,0,0) and color of Bg = (255,255,255), except for the part within current line where color of Bg = (232,232,255)

    When the α value has the median value 128 :

    The RGB values of the background part of selection NOT in current line are 223,223,223 ≈ ( 128 × 192 + 127 × 255 ) / 255

    The RGB values of the background part of selection WITHIN the current line are 212,212,223 ≈ ( 128 × 192 + 127 × ( 232 | 232 | 255) ) / 255

    the RGB values of the foreground ( text ) of the selection are 96,96,96 ≈ 128 × 127 / 255

    So, in the end, the values between 120 and 140 and, of course, 256 seem only interesting. And value 128, in the middle, is the good compromise !

    In the specific case of α = 256, the transparency on BOTH foreground and background colors is desactiveted. However, we can consider that the resulting selection is a blend of a foreground and background opaque selection with an existing default black text on a default white background. Thus, using the above formulas and 256 as α value, we get :

    Resulting Selection Background = ( 256 × 192 + ( 255 - 256 ) × 255 ) / 255 ≈ 191,75… => Background selection color = 192,192,192

    Resulting Selection Foreground = ( 256 × 0 + ( 255 - 256 ) × 0 ) / 255 = 0 => Foreground selection color = 0,0,0

    Best Regards,

    guy038

  • Suddenly unable to search within a document!

    6
    0 Votes
    6 Posts
    234 Views
    G

    @mkupper Thank you. Interesting. I never changed those settings, but following your instructions resolved the issue.

  • Find files that don't contain

    7
    0 Votes
    7 Posts
    3k Views
    Alan KilbornA

    Here’s a real feature request for making “Find files that don’t contain” a part of standard Notepad++: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/15680

  • Is there a way to keep a blank "working space" as I'm logging information?

    11
    0 Votes
    11 Posts
    524 Views
    Alan KilbornA

    @guy038 said :

    Here is the list

    Which hopefully bears some similarity to:

    https://www.scintilla.org/ScintillaDoc.html#SCI_SETYCARETPOLICY

    :-)

  • AutoIt opens notepad++ with "Folder as Workspace" open

    11
    0 Votes
    11 Posts
    694 Views
    Alchemist ZimA

    @PeterJones said (I do still highly recommend not running in Admin mode except when you absolutely have to.)
    I’m logged in as ADMIN with UAC turned off
    I know its not best practices, but it works for me

    Thank You for the help

  • Is there a settting for :"high visibility" options?

    4
    0 Votes
    4 Posts
    340 Views
    Alan KilbornA

    @DSperber1 :

    Looks a bit above my pay grade, and all things considered I think I’ll just stick with N++ in its stock form.

    Your choice, but it really isn’t that hard to just use something as opposed to writing it yourself. Someone else already did what’s “hard” about it.

    having some kind of a “ruler” effect in order to guide the eye as it scans on a single line from left to right is a very useful feature

    There can be a lot of coloring going on in a file’s presentation, depending upon the file type. Probably it was thought that an every-other line coloring was too much for the standard product. Certainly for “plain” files where there isn’t any other coloring going on, it makes some sense.

    You can always make a feature request for it; see details HERE on how exactly to do that.

  • Issues with Syntax Highlighting for a Custom Language - Emmanuel Katto

    2
    0 Votes
    2 Posts
    287 Views
    PeterJonesP

    @Emmanuel-Katto ,

    I’ve created a user-defined language (UDL) but it doesn’t seem to highlight keywords and functions correctly

    It does for me. Could you be a bit more specific?

    I’m not sure how to properly categorize keywords, functions, and comments.

    Put your various keywords in the different Keywords fields; if you have different groups of keywords that you want styled differently, put them in different fields, otherwise you can just put all the keywords together.

    For UDL, “Functions” are just a kind of keyword, from the perspective of a UDL (or any of the builtin syntax highlighters). Unless you are talking about the Function List panel in Notepad++, in which case you need to set up the FunctionList definition as described in the User Manual > Config Files > Function List Definitions. Our Function List Basics FAQ is a great starting point for understanding the structure of the Function List definition. However, getting the regex right for classes and functions can be a bit tricky… it’s usually best to start at the simplest, and slowly increase the complexity of the regex with frequent testing. (And Function List definitions are annoying, in that you have to restart Notepad++ with every change you make, no way around it.)

    UDL Comments are a separate concept from keywords, and I am not sure why you are trying to “categorize” comments alongside keywords. You just set up the Comment Line Style and/or Comment Style, and then the comments are styled separately (and, unless you enable the checkmarks in those Styler boxes, there won’t be any keywords or other syntax highlighting inside a comment)

    After making changes to the UDL, I’ve noticed that sometimes they don’t appear to take effect immediately

    They do take effect immediately. Not sure why it seems to you that they don’t.

    Start with:
    c70ea7be-99e4-4340-a3ae-03a09c119e9a-image.png

    …then add Styler settings and word2 to the 2nd group, and it takes effect immediately:
    7a2b8c5b-269c-4636-aaad-34bd84dc8389-image.png

    But because your complaints were rather vague, I can just give overview-style help. “More details” is “more better” when asking for this kind of help.

  • Why does this regexp get greedy when I use replace-all?

    7
    0 Votes
    7 Posts
    359 Views
    guy038G

    Hello, @mkupper, @alan-kilborn, @coises and All,

    So, as a summury, to delete the first standard character, only, of any line, of current file, use one the following search regex S/R :

    SEARCH (?-s)^.(.)?

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

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

    And use :

    REPLACE \1 or $1

    Now, an other possibility would be to add a character or string, that you are certain is NOT part of current file. Then you’ll run the two consecutive regex S/R, below :

    SEARCH ^

    REPLACE Your characterorstring ( like ¤ or xyzt , for example )

    And :

    SEARCH (?-s)¤.?    or    (?-s)xyzt.?

    REPLACE Leave EMPTY

    You may also join these two regex S/R in a single one :

    SEARCH ¤.?|(^)

    REPLACE ?1¤

    Or :

    SEARCH xyzt.?|(^)

    REPLACE ?1xyzt

    And click TWICE on the Replace All button !

    Best Regards,

    guy038

  • Regex keyword list

    2
    0 Votes
    2 Posts
    171 Views
    PeterJonesP

    @filipe-Medeiros

    No, it does not.

    However, you can use the EnhanceAnyLexer plugin to use a regex to change the foreground color on words for a UDL.

    Assuming you had a udl called MyUDL, then the config section

    [MyUDL] 0x0000FF = \bword\d+\b 0x00FF00 = \bgreen_\w+\b

    that would color word1 or word987 as red, and anything starting with green_ using a green foreground.

    Using that idea, you could define most of your UDL’s keywords in the normal UDL interface, and add EnhanceAnyLexer to do additional keywords using regex

  • Replacing all spaces between a string and the newline character

    6
    0 Votes
    6 Posts
    541 Views
    guy038G

    Hi @kiyn, @alan-kilborn and All,

    Ah… You right about it, Alan. Sorry, I was concentrating on my example !

    So, regarding the general case and to be rigourous, we should use the generic regular expression itself :

    SEARCH (?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\K(?-si:FR)

    REPLACE RR

    where :

    FR = \x20 ( a space char )

    RR = %20

    BSR = FILE:///

    ESR = The end of any link, beginning with file:/// or FILE:/// : for example, \.mp3 or \.com|\.us or simply \.\w{2,}

    Notes :

    We can replace the (?-si: modifiers, at the beginning of the regex, by the insensitive modifier (?i: only

    We can omit the (?s-i: modifiers, in the middle of the regex, and keep only the non-capturing group (?:(?!ESR).)

    We can omit the (?-si: modifiers and the non-capturing group, all together, at the end of the regex

    So the generic regex can simply be expressed as :

    SEARCH (?i:BSR|(?!\A)\G)(?:(?!ESR).)*?\KFR

    REPLACE RR

    Thus, the functional regex S/R becomes :

    SEARCH (?i:FILE:///|(?!\A)\G)(?:(?!\.\w{2,}).)*?\K\x20

    REPLACE %20

    And from this INPUT text :

    file:///D:\Documentation\Musique\Marilyne\Amy Winehouse - Back To Black.com first Test Second test file:///D:\Documentation\Musique\Marilyne\Jason Marz|I'm Yours.fr FILE:///D:\Documentation\Musique\Marilyne\Norah Jones - Toes.us. Third test Fourth test file:///D:\Documentation\Musique\Marilyne\Scorpions - Still Loving You.gouv fifth and final test file:///D:\Documentation\Musique\Marilyne\Norah Jones - Wake Me Up.MP3

    We get this OUTPUT text :

    file:///D:\Documentation\Musique\Marilyne\Amy%20Winehouse%20-%20Back%20To%20Black.com first Test Second test file:///D:\Documentation\Musique\Marilyne\Jason%20Marz|I'm%20Yours.fr FILE:///D:\Documentation\Musique\Marilyne\Norah%20Jones%20-%20Toes.us. Third test Fourth test file:///D:\Documentation\Musique\Marilyne\Scorpions%20-%20Still%20Loving%20You.gouv fifth and final test file:///D:\Documentation\Musique\Marilyne\Norah%20Jones%20-%20Wake%20Me%20Up.MP3

    BR

    guy038

  • Notepad++ not responding

    5
    0 Votes
    5 Posts
    17k Views
    Ashutosh SharmaA

    @mere-human Worked for me. Thanks

  • How to delete specific lines only with macro

    5
    0 Votes
    5 Posts
    221 Views
    Dominic LeblancD

    Thanks Guy, I really appreciate your help!

  • need to replace the pipe with / and remove the quotes in text

    6
    2 Votes
    6 Posts
    527 Views
    Thomas KnoefelT

    @Aj-Jarrard
    Or you can use MultiReplace Plugin to target specific columns and replace content only in these columns. … and you can even colorize your columns with that Plugin.

    2944b529-869d-4176-b624-e42423c475e4-image.png

  • DoxyIT on 64bit: Access violation

    5
    1 Votes
    5 Posts
    504 Views
    C

    @Clicketyclick Well I caved in and build myself a Python 2 script that does the job - for me at least. It’s available on my Github: clicketyclick.github.io/TipsAndTricks/Notepad++/Doxyit

  • Notes are getting deleted from Notepad++

    3
    0 Votes
    3 Posts
    451 Views
    EkopalypseE

    @Duty-Lead
    What version of Npp are you using?
    Can you post the debug information from the ? menu?

    Whatever i have written in notepad++, it is getting deleted after 4-5 days automatically

    What does that mean?
    The files are still there, but the contents have been removed? That would be very confusing!
    Or have the files disappeared? If so, which files are we talking about? Files that were backed up automatically?
    That is, that you did not save manually?
    I’m guessing you have software like CCleaner running that removes temporary stuff depending on the settings.