• Complex regex substitution

    8
    0 Votes
    8 Posts
    3k Views
    Simone SpinozziS

    @cipher-1024

    it’s not json and the tabs are just there to allow spacing so that they “look good” on a single line when a bunch of them are all there at the same time. (basically they line up stuff vertically… and yes… that sounds idiotic… but i did not write the original “code” 😅) It cannot be on multiple lines as the intepreter of the code sees every new line as a different “item”. I did not write the interpreter, i’m just trying to help modify a bunch of items at the same time. Thus i cannot change the writing “language”. The task was to learn how to change multiple instances of similar things all at once so that in the future these things can be changed easily.
  • Matlab cell mode highlight mechanism

    5
    0 Votes
    5 Posts
    3k Views
    Ms NM

    I think you are right. I will give the function list method a go.
    https://notepad-plus-plus.org/features/function-list.html

  • extended character search suddenly not working.

    Locked
    2
    0 Votes
    2 Posts
    1k Views
    Scott SumnerS

    @Mark-Gould

    Maybe you are just doing it wrong. But since you didn’t tell us what you are doing, no one can make a judgment. :-(

    Maybe check this thread for generic troubleshooting tips?

  • Update to 7.5.3, file encode wrong

    3
    0 Votes
    3 Posts
    2k Views
    Hung Tran PhiH

    Thanks for your response, I uninstalled 7.5.3 and installed 7.5.1, problem solved :).

  • No preferences saving used notepad++ in WinSCP

    4
    0 Votes
    4 Posts
    2k Views
    Claudia FrankC

    @Sybell-Lirwaco said:

    only saved if the instance in which these changes were made was closed. Correct?

    To be honest, haven’t tested it but I assume this is correct and makes sense.

    Cheers
    Claudia

  • Macro Complex instructions.

    9
    0 Votes
    9 Posts
    4k Views
    PeterJonesP

    For completeness, I eventually found the bug in mine: I was misusing range(start, end) – I thought it included end when iterating over the range, but it only uses the values less than end.

    The following is my code, with the bug fixed (and some of my debug prints left in) that I think now does what was requested… though @Claudia-Frank did it much more succinctly… and the magic of @guy038 regex ability is virtually limitless. :-)

    # editor1 is the PythonScript object instance for the first (left or top) document window in NPP # editor2 is the instance for the second (right or bottom) document window # Python's range(start, stop) operator will keep going while the index variable is LESS THAN stop, so it will never use stop: https://docs.python.org/2/library/functions.html#range for lineNumber in range(0, editor1.getLineCount() ): # grab the nth line from File1 (exclude newline) editor1.gotoLine(lineNumber) newValue = editor1.getCurLine().rstrip() console.write("editor1: #" + str(lineNumber) + " = \"" + newValue + "\"\n") editor2.documentEnd() # go to the last position end2 = editor2.getCurrentPos() # record the position console.write("editor2.end = " + str(end2)+"\n") editor2.documentStart() # back to the beginning start2 = editor2.getCurrentPos() # record the position console.write("editor2.start = " + str(start2)+"\n") # want to replace two "xxx" entries in File2 with each line from File1 for time in range(0, 2): console.write("time# " + str(time) + "!!!\n") # look for the first occurrence of 'xxx', starting at start2 and ending at end2 # position is a tuple with the start and end locations of the match position = editor2.findText( FINDOPTION.MATCHCASE, start2, end2, "xxx") if position is None: console.write("editor2.position is NONE, so skipping...\n") break # don't try to replace console.write("editor2: findText @ " + str(position[0]) + ":" + str(position[1]) + "\n") # select the "xxx" editor2.setSelectionStart(position[0]) editor2.setSelectionEnd(position[1]) # replace the selection with newValue editor2.replaceSel(newValue) # the cursor is now at the end of the replaced value, and we want to start2 = editor2.getCurrentPos() console.write("Start2: " + str(start2)+"\n") console.write("next source line...\n")
  • Help with NppFTP

    3
    0 Votes
    3 Posts
    2k Views
    chcgC

    See also https://ashkulz.github.io/NppFTP/. As Peter wrote additional infos about the used versions would be helpful.

  • 'Find and Replace' question

    13
    1 Votes
    13 Posts
    4k Views
    Oleg NemchenkoO

    @Scott-Sumner that`s amazing. Thank you very much for your help!

  • Problem with multiple portable versions in Windows 7

    Locked
    1
    0 Votes
    1 Posts
    957 Views
    No one has replied
  • Open as does not work anymore on 64bits

    Locked
    1
    0 Votes
    1 Posts
    791 Views
    No one has replied
  • How do you run your code ?

    3
    0 Votes
    3 Posts
    2k Views
    Scott SumnerS

    @Student-Bhuvan-Kudupudi

    How do you run your code?

    Very well indeed, thank you for asking. :-)

  • NppExec compiling multiple languages

    Locked
    4
    0 Votes
    4 Posts
    3k Views
    Claudia FrankC

    @Pietro-Nobili

    Pietro, I had something different in mind.
    Copy the following into nppexec dialog and run it on a python script,
    then you should see the full file path output, when running on txt file
    only a statement is shown. No need for an addition batch file.

    if $(EXT_PART) == .py goto python if $(EXT_PART) == .txt goto whatever goto end :python echo run full file path:$(FULL_CURRENT_PATH) goto end :whatever echo some text file :end echo "END"
  • how to realise vuejs in notepad++?

    Locked
    2
    0 Votes
    2 Posts
    10k Views
    Claudia FrankC

    @BBP-B

    I assume you will find your answer here.

    Cheers
    Claudia

  • macro. remove replace/search dialog

    Locked
    5
    0 Votes
    5 Posts
    2k Views
    Claudia FrankC

    @Rodrigez-Yaves

    By updating npp it is solved, because, as Alan already suggested, newer version
    don’t use a popup window anymore.
    I tried different things with your 6.1.3 version but wasn’t able to record the button press of
    the confirmation dialog.

    Cheers
    Claudia

  • Alt-f1 php help suddenly stopped working.

    Locked
    5
    1 Votes
    5 Posts
    2k Views
    Jean CremersJ

    Thanks Claudia. Only half an hour later and i have my alt-f1 back! You’re great.

  • Batch files being opened in Notepad++ rather than being executed

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    richluxR

    Hold the Shift Key down and Right-Mouse click the batch file. This should allow you to select “Open With…” and then choose the program used to open the file.

    Rich

  • Notepad++ fault; deleted entire content of my file

    Locked
    2
  • spelling verification in comments ?

    Locked
    5
    0 Votes
    5 Posts
    2k Views
    Jean-Yves BretonJ

    You’re right, i confused the two elements. Now I downloaded the french dictionary for DSpellCheck, choosed the French option in its menu option, and now everything works fine. Thank you very much!

  • How to find lines with words that are Capitalised

    Locked
    2
    0 Votes
    2 Posts
    5k Views
    PeterJonesP

    Let’s see if I can beat @guy038 to it:

    As a first pass, assuming one sentence per line (every line is defined as a sentence, and only one sentence per line). Also assume we aren’t requiring upper-case as the first character in the line

    Find What: (?-is)^.+[A-Z].*\R Replace With: `` (empty)

    Source Document:

    Keep this line. Hello, my name is Inigo Montoya, prepare to delete this line. This is okay. Delete me, Yoda shall. starting lowercase is okay, too but not if there's a Capital

    Final:

    Keep this line. This is okay. starting lowercase is okay, too

    Explanation:

    (?-is) = make it case sensitive; don’t span multiple lines ^ = start match at beginning of the line .+ = allow 1 or more of any character (this means that it won’t care if the first letter is upper case, because that will be taken up by the “allow 1”) [A-Z] = require one capital letter somewhere not in the first character .* = allow 0 or more any-character after the required capital letter \R = include the newline (either CRLF or just LF) in the match If all that matches, then replace with blank (since replacing the newline also, the whole line is deleted)

    However, this will not work when there are multiline sentences, or if you have multiple sentences in a line

    Multiline sentence won't work, because it will assume Previous Line is okay, even though this has capital, and the second line of this sentence will delete, but not the first or third. Multiple sentences won't work. Defining end of sentence is harder. Some People use period-two-spaces, and some only period-space. And how do you want to handle Mr. John Doe? Or sentences that "end inside the quote." And this becomes a Second sentence

    If you want more than the assumptions I made above, you will have to give a lot more details, and you may have to accept that you need a more intelligent parser than just a readable regex. (@guy038 may be able to get all of the edge cases in one regex, depending on what your rules are… but it will be a lot more complex than the one I showed…)

  • Colorization bug in XML

    Locked
    3
    0 Votes
    3 Posts
    1k Views
    Thibault CastelT

    Thank you! I’ll wait the next release :)