• Help me Replace in line

    2
    0 Votes
    2 Posts
    242 Views
    PeterJonesP

    @Daniel-Soares ,

    FIND WHAT = (?-s)\A^(.*\R){15}^.*?\K5 REPLACE WITH = [REPLACEMENT] REPLACE ALL (multiple times)

    will change

    5 one 5 0 3 5 two 5 0 3 5 three 5 0 3 5 four 5 0 3 5 five 5 0 3 5 six 5 0 3 5 seven 5 0 3 5 eight 5 0 3 5 nine 5 0 3 5 ten 5 0 3 5 eleven 5 0 3 5 twelve 5 0 3 5 thirteen 5 0 3 5 fourteen 5 0 3 5 fifteen 5 0 3 5 sixteen 5 0 3 5 seventeen 5 0 3

    into

    5 one 5 0 3 5 two 5 0 3 5 three 5 0 3 5 four 5 0 3 5 five 5 0 3 5 six 5 0 3 5 seven 5 0 3 5 eight 5 0 3 5 nine 5 0 3 5 ten 5 0 3 5 eleven 5 0 3 5 twelve 5 0 3 5 thirteen 5 0 3 5 fourteen 5 0 3 5 fifteen 5 0 3 [REPLACEMENT] sixteen [REPLACEMENT] 0 3 5 seventeen 5 0 3

    If this is not sufficient, I suggest explaining yourself better with example before and after data formatted as data, and otherwise follow all the advice that I will quote below; if you choose to ignore some or all of this advice, you will find that the answers you get are not overly helpful, because you’re making us guess, and we will guess wrong (in total or in part).

    ----

    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 </> toolbar button or manual Markdown syntax. Screenshots can be pasted from the clipboard to your post using Ctrl+V 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 and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get… Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.

  • Lost text after crash

    2
    0 Votes
    2 Posts
    283 Views
    Alan KilbornA

    @Rowan-Sylvester-Bradley

    It sounds like you are a victim of a long-standing Notepad++ problem.
    It is likely that you will not be able to recover your data.
    You might want to read all/some of THIS discussion thread.

    All is not doom-and-gloom however.
    There is supposedly a fix for the problem; however it isn’t in released code as of this writing; it will likely be in whatever is the next release after 7.9; probably 7.9.1.

  • batch replace string with filename

    2
    0 Votes
    2 Posts
    1k Views
    Terry RT

    @derezu-pezupop said in batch replace string with filename:

    How can notepad++ replace each one with the filename in a batch operation?

    I’m not on a PC at the moment but there was a post I was involved in solving some time ago to add filename to files. Have a read of
    https://community.notepad-plus-plus.org/topic/17035/batch-function-need-to-add-filename-at-the-end-of-each-paragraph
    and see if maybe it could, with some alterations, provide the solution for you.

    Terry

  • SCI_LINEDOWNRECTEXTEND issue

    14
    1 Votes
    14 Posts
    943 Views
    EkopalypseE

    @Ekopalypse

    But testing this reveals that the layout gets switched but column selection still works :-(

  • permanent download link for latest version

    2
    0 Votes
    2 Posts
    314 Views
  • Function List: Is file extension of User Defined Language still working?

    16
    2 Votes
    16 Posts
    1k Views
    ArkadiuszMichalskiA

    @donho But few UDL is not problem, what if someone has to make a lot of them and gets a trash on the menu?
    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4896#issuecomment-706421610

  • Opening files failing

    4
    0 Votes
    4 Posts
    325 Views
    BiBi-AbcB

    @PeterJones said in Opening files failing:

    e

    You’re right sorry. I was trying to bring more attention to the issue.

  • Max menu item width for "localized" text

    3
    3 Votes
    3 Posts
    222 Views
    Alan KilbornA

    @PeterJones

    Thanks for your thoughts.
    Maybe this will be the thing to kick me into making a github issue; till now I’ve just been a browser there. :-)

  • Display XML markup in LTR direction, content RTL

    6
    0 Votes
    6 Posts
    1k Views
    David ShakedD

    For the record, I found a possible solution. Since I am creating the XML schema myself, I can define the element and attribute names in Hebrew characters. When I set Notepad++ to the RTL text orientation, it displays both the Hebrew content and the Hebrew XML tags in a readable way.

    From a development point of view, it’s a quirky and non-portable solution. See:
    https://www.w3.org/International/questions/qa-non-eng-tags

    If anyone else has experience with this issue, I will be grateful to hear from them.

  • Filling empty lines with previous line

    7
    0 Votes
    7 Posts
    1k Views
    Viktoria OntapadoV

    As usual, I really appreciate the answers, very impressive solutions. I tested the script as well, works like a charm. Thank you so much for the invaluable help.

    Have a nice day,
    Viktória

  • Regex alternation in both FIND & REPLACE strings

    9
    1 Votes
    9 Posts
    901 Views
    M Andre Z EckenrodeM

    @guy038 said in Regex alternation in both FIND & REPLACE strings:

    Ok, so you could refer to this link to get the main punctuation characters :

    https://www.unicode.org/charts/PDF/U2000.pdf

    Thank. I’ll keep that in mind for if/when I ever need to use Unicode text on a large scale, though I’m not currently anticipating it will happen.

    This means that the part "\x20\x{2014}\x20, at the end, is rewritten whatever group matches the search regex.

    Ok, thanks for the detailed explanation and further suggestions as well. I will look for opportunities to apply them in future projects.

  • 0 Votes
    7 Posts
    2k Views
    guy038G

    Hi, @wagner-leung, @alan-kilborn and All,

    My bad ! So, if I interpret your intended result, strictly, the regex S/R becomes :

    SEARCH (?s)object((?!object).)+?type=2((?!object).)+?\K\babc(?=\h*=)

    REPLACE **aaa**

    Hope this version is the good one ! Of course, you may change the line type=2 and/or the variable abc as you like !

    Cheers,

    guy038

    P.S. :

    An other formulation of the search regex, using the free-spacing mode (?x) , would be :

    SEARCH (?xs) object ((?!object).)+? type=2 ((?!object).)+? \K\b abc (?=\h*=)

    For instance, the following search regex would search for the variable abc, in any object block containing, either, the line type=2 or type=3

    SEARCH (?xs) object ((?!object).)+? type=[23] ((?!object).)+? \K\b abc (?=\h*=)

  • Notepad ++ v7.9 does not download Dspell dictionaries.

    2
    0 Votes
    2 Posts
    315 Views
  • Add comma between two sentences on a two language document

    7
    0 Votes
    7 Posts
    414 Views
    guy038G

    Hi, @ali-jafari and All,

    Unfortunately, I cannot give you valuable information :-(( I’m presently using, on my old XP laptop, the Microsoft Office Suite2002, which is good enough for my Word’s work !

    SEARCH ( for Word ) : ([^0033-^0126])^0032*([^1536-^1791])

    REPLACE ( for Word ) : \1,\2

    In Word 2002, when your tick the search option Use generic characters, any non-Unicode char ( below \x0100 ), must be written as ^####, where #### represents the decimal value of the code-point. So, \x{0021} must be changed as ^0033, \x{007E} as ^0126 and so on…

    Unfortunately, syntaxes over \xFF, as for the main Arabic range [^1536-^1791], that is to say {\x{0600}-{06FF}] in N++ ), is definitively not a valid syntax :-((

    Moreover, the quantifier syntax {0,n}, after a possible space char, does not work, too. The {1,n}, only, seems valid ! So I prefered to use the usual * syntax

    Certainly, the recent versions of Word allows the search of characters of the BMP ( so from \x{0000} to \x{FFFF} ). If so, the proposed regex S/R should work correctly !

    On the other hand, why not process with the N++ regex engine, first and, then, paste your updated text in Word ?

    Cheers,

    guy038

  • Search for: and Replace with:

    13
    0 Votes
    13 Posts
    861 Views
    Olivier ThomasO

    Alan Kilborn wrote:
    If you ask a regexIf you ask a regex question here, and someone attempts to answer it (I will pay closer attention to who is asking in the future, and if it appears to be you I probably won’t answer), it will be answered from the perspective of Notepad++.
    So your goal won’t be achieved.

    PeterJones wrote:
    1.Your abuse of the forum doesn’t change the subject of the forum.

    2.If you create another new account sometime, I will call it out, so that other users will understand who it is that they are responding to, but other than that, I will go back to not replying to you, in any of your versions, because all that ever happens between us is arguing, and that doesn’t help anyone.

    I tried to explain everything, but … you don’t understand.
    And I realized that in the future I cannot count on your help.

    M Andre Z Eckenrode
    „(I hereby swear that the advice requested in this post is intended for use specifically in Notepad++.)”
    Are you not ashamed of it?

    However, I am tempted to write about this parable about „the gardener’s dog”.

    He himself won’t eat … but he won’t let anyone else either.

    You don’t have to write back, I don’t expect a reasonable answer.
    You can take 120 out of a 20-minute break.

    Greetings.

  • run python script to multiple opened files

    4
    0 Votes
    4 Posts
    1k Views
    Nick BrownN
    from Npp import * def forEachFile(func): for file in notepad.getFiles(): notepad.activateBufferID(file[1]) func() def printFilename(): print notepad.getCurrentFilename() # store the current buffer id currentBufferID = notepad.getCurrentBufferID() # run our printFilename function on each open file forEachFile(printFilename) # restore the current buffer from the stored buffer id. notepad.activateBufferID(currentBufferID)
  • 0 Votes
    5 Posts
    393 Views
    VijayPrabakarV

    ``Hi

    The requirement It is not very technical related to Java… I Just mentioned like that…

    My requirement is,
    Always the java file will have package line as below

    package com.abc.edf.*

    I want to copy this line from the list of all the java files and paste above package line only in new.txt file

    ``

  • The Nul Error

    11
    0 Votes
    11 Posts
    891 Views
    Alan KilbornA

    @PeterJones said in The Nul Error:

    and click on the “Bookmark 1 ♥” again

    Works, thanks!!

  • Can I see a preview for the result of the "replace" form?

    14
    0 Votes
    14 Posts
    672 Views
    pnedevP

    @Alan-Kilborn said in Can I see a preview for the result of the "replace" form?:

    Isn’t there another way for the plugin to do what it needs to without messing with the undo history?
    If you release your version of the plugin, maybe give it a slightly different name to prevent confusion.

    Unfortunately Compare plugin cannot circumvent the Undo history clean-up.

    The new plugin will be called ComparePlus, it has completely new alignment approach and keeps the Undo intact.
    It is almost finished but sadly that’s its state for about 8 months now. I’m not sure when exactly it will be ready.

    BR