• Newbie find and replace

    Locked
    3
    2 Votes
    3 Posts
    972 Views
    Tony HagerT

    Thank you very much!

  • find in files

    Locked
    2
    0 Votes
    2 Posts
    597 Views
    Scott SumnerS

    @Robert-Miller

    Sounds like that is the Find in Files feature conducting its search…seems like normal behavior–do you disagree?

  • Help. Need regex

    3
    0 Votes
    3 Posts
    849 Views
    Terry RT

    First off, apologies @Евгений-Фокин , I misread your question. I’ve come back to it now as I didn’t see you reply to my solution. @Claudia-Frank had upvoted my answer but also misread the question.

    I can see now that in fact you were only wanting to remove the:
    text autoid…</text> IF the line starting with <replacement> in that group of lines had Russian characters in it.

    I have a revised regex which I think fits what you intended. I would suggest testing it by using in ‘Find’ mode first. You could have it bookmark all the instances that it thinks fit the criteria, then look at those before deciding to remove.
    Find What: (?s)<text.+?<replacement><\!\[CDATA\[[\x{080}-\x{4af}].+?text>\R?
    Replace with: empty field here

    The part that checks for a Russian character is the \x{080}-\x{4af}, I hope I’ve got that sequence correct. It only checks the first character, hopefully no non-Cyrillic character at the start with Cyrillic afterwards.

    I would like to hear back from you regardless of whether it helps or not. if it does NOT help, we on the forum are only too willing to offer up other possible solutions.

    Terry

  • Shifting a block of text to the beginning of a line

    Locked
    11
    0 Votes
    11 Posts
    2k Views
    C Ananda RaoC

    Dear Mr Sumner

    Thank you! It worked now.
    I am a little embarrassed to say, but I do not know what I did wrong the first time and what I did right this time.

    Best Regards!

    PS. I am using Notepad++ v7.5.8 32bit

  • help about lines arabic

    Locked
    4
    2 Votes
    4 Posts
    826 Views
    Claudia FrankC

    @saud-s.k

    a little bit cryptic but this one can do it

    editor.setText('\r\n'.join(reversed(['[keep.text]{}'.format(x) for x in editor.getText().splitlines()])))

    Cheers
    Claudia

  • Select multiple words / Copy multiple words

    Locked
    4
    0 Votes
    4 Posts
    1k Views
    Scott SumnerS

    @Terry-R

    I think your idea was covered in the thread I pointed to earlier…see where @guy038 in that thread says:

    SEARCH (?s)^.*?(Your regex to match)|(?s).*\z
    REPLACE…etc

    Like your recent suggestion, that is a destructive search, which may be a downside, although a simple Undo can take care of that after the resultant data is Copy’d out…

  • RegExp full syntax

    Locked
    5
    1 Votes
    5 Posts
    1k Views
    Scott SumnerS

    Ah, okay, I see from your first posting what you mean. No, Notepad++ has no built-in way of doing that. However, it is doable with a bit of prep work. These threads will show how:

    https://notepad-plus-plus.org/community/topic/15318/replace-text-with-incremented-counter https://notepad-plus-plus.org/community/topic/12967/replace-string-across-multiple-files-and-increment-value
  • How to insert [Path+Filename] into the Notepad text ?

    Locked
    4
    2 Votes
    4 Posts
    4k Views
    Elodie CEMOIE

    Thank you very much !

  • Finding multiple lines in multiple files and deleting just those lines

    26
    0 Votes
    26 Posts
    9k Views
    Steve Wilson105S

    Like I said, I understand MUCH better what the regex is supposed to do and is doing. This is the regex I’m using:
    (?i)^.?(<font.?|\sync.?correct|www.|.(?=Help other users)|please rate|Professional Translation|advertise your|== for|WWW.MY-SUBS.COM|SLY@Moon|subXpacio|www.opensubtitles.org|Open Subtitles MKV Player|Subtitles by|Synchr:AA|Support us and become VIP|to remove all ads|AmericasCardroom|.(?=Synced and corrected by BLuk)|Subrip by|million dollar).?\R

    It works flawlessly. If I run this regex on a directory of files and some of the files have consecutive lines listed for removal in the regex, I’ll get a message at the end like “Replace in Files: 26 occurrences replaced”. If I run the regex until it says “Replace in Files: 0 occurrences replaced”, all of the lines (including the multiple consecutive lines) will have been replaced. Except - occasionally there will be multiple consecutive lines at the very end of the subtitle I’m editing. In those instances, the very last line won’t have been removed. I can solve that fairly simply by loading every subtitle into NP++ and just making sure that there’s a blank line (simply a CR/FL) for the last line. I’ve tried to create a regex to do just that, but they aren’t working. It’s not a huge deal - this is MUCH better and I’m very appreciative, but if what I’m looking for is a trivial thing and anyone has suggestions they’d be very welcome.

    As always, thanks very much

  • You cannot receive donation?

    Locked
    1
    0 Votes
    1 Posts
    417 Views
    No one has replied
  • Convertxt macro

    Locked
    2
    0 Votes
    2 Posts
    622 Views
    Terry RT

    Can you provide some more detail? Macros are generally created by users for their own purposes, so is it possible whom ever is asking you to do this might have more information?

    Do you know what sort of function this macro does to your file. If it changes the source data a lot then it might actually be a ‘plugin’. These are programs that users can make using other programming languages, which are then incorporated into NPP to enhance it’s usefulness.

    Terry

  • case sensive

    Locked
    2
    0 Votes
    2 Posts
    593 Views
    PeterJonesP

    I assume you want “case sensitive matching” during a Find or Find And Replace? If so, then the toggle is in the same place it’s always been: in the Find dialog, there’s a ☑ Match Case which needs to be toggled on to match case, or off to ignore case.

  • command to compile and execute code in COBOL

    Locked
    3
    0 Votes
    3 Posts
    2k Views
    PeterJonesP

    … For example, here’s an NppExec script that I use to save, compile, and run a standalone C++ program:

    npp_save cd "$(CURRENT_DIRECTORY)" g++ "$(FILE_NAME)" -o "$(NAME_PART)" npp_run cmd.exe /k "$(NAME_PART)"

    For compiling cobol, you would use your cobol compiler rather than “g++”, and would have to format the command line appropriately; if your compiler is not in your path, you will have to do something like “c:\full\path\to\compileCobol.exe”.

    If you don’t want to also run the program when compiled, then you could just remove the “npp_run …” command from the NppExec script.

  • Delete LF

    Locked
    2
    0 Votes
    2 Posts
    1k Views
    Scott SumnerS

    @Jose-Emilio-Osorio

    You could use a negative lookbehind assertion, e.g. (?<!\r)\n

    How did you get mismatched line-endings in your file, anyway?

  • Not remembering opened NppConsole

    Locked
    2
    0 Votes
    2 Posts
    697 Views
    Claudia FrankC

    @Esteban-Julián

    you probably better asking at the NppConsole forum
    unless you find someone here using it and knows the answer

    Cheers
    Claudia

  • Replace a special character

    Locked
    6
    0 Votes
    6 Posts
    2k Views
    Jose Emilio OsorioJ

    Thanks. It works without the + and ?.

  • Remember hidden lines after unhiding

    Locked
    4
    1 Votes
    4 Posts
    1k Views
    Claudia FrankC

    @Kris-S.

    I don’t know of a plugin doing this maybe someone else does.
    Npp itself offers this functionality only if you use folding instead of hiding but
    this means your document lexer needs to support this.

    I’m currently thinking about a python script solution but this raises the question,
    about the logic when to hide, which documents should be affected …

    Cheers
    Claudia

  • Creating and running macros

    19
    0 Votes
    19 Posts
    16k Views
    PeterJonesP

    @Tony-Moody,

    You must not …

    That’s not strictly true. “You must be careful if you …” would be the better way of phrasing that.

    C:\Documents and Settings\<username>\Application Data\Notepad++\shortcuts.xml

    And I can now identify that you’re on an older Windows, such as Win2k or WinXP. For more on the %AppData%, see our FAQ on the topic – which includes an explanation for how the simplest way to access folders in the user-app-data hierarchy is by %AppData%\FolderName, so you don’t have to know which file hierarchy your system uses.

    What I do is record a macro and run it to check. If it needs altering I either record it again or I have a go at editing it. One can add macros together by editing.

    Yep, those are good, solid advice.

    Editing Configuration Files

    As it says in NpWiki++: Configuration Files, “Because Notepad++ updates some of its configuration files on normal program termination, manual editing of a Notepad++ configuration file requires both specific procedures and good knowledge of the files’ layout. It is strongly advised to read about how to edit configuration files and the knowledge base for file layouts.”

    The editing configuration files page claims you have to mark the files as read-only, but that’s not technically accurate, either.

    Notepad++ will overwrite the shortcuts.xml file when it exits… but only if you’ve recorded a new Macro, or if you’ve used the Settings > Shortcut Mapper or Macro > Modify Shortcut / Delete Macro…. (There may be one or two other circumstances that I haven’t thought of, but if there are, they seem to be more rare.)

    A sequence that has always worked for me, every time, for editing the shortcuts.xml from within Notepad++:

    Close all active instances of Notepad++. This will make sure Notepad++ saves any changes it needs to save into shortcuts.xml. Open one instance of Notepad++. Do nothing else regarding Notepad++, other than what’s described in these steps, while following these instructions. Do not open another instance. Do not change GUI settings, especially the Shortcut Mapper… or Modify Shortcut / Delete Macro…. Open %AppData%\Notepad++\shortcuts.xml using that one instance of Notepad++ if you’re in a portable installation, open the local shortcuts.xml instead Make your edits to shortcuts.xml using that one Notepad++, without opening any other instances. Save shortcuts.xml Close that one instance of Notepad++. When you open Notepad++ again, the changes you made should take effect if you handcrafted a new macro, or edited an existing one, it should be available in the Macro menu. You can also re-load shortcuts.xml to make sure the changes are still in place; they should be (they are for me). If shortcuts.xml is open, either Close shortcuts.xml again, so that you don’t expect it to be editable this time,
    or if you do want to safely edit shortcuts.xml more, and haven’t done anything else with Notepad++, you’re effectively back at step #3 right now, and can continue the sequence from there
  • 0 Votes
    1 Posts
    473 Views
    No one has replied
  • can't donate

    Locked
    1
    1 Votes
    1 Posts
    513 Views
    No one has replied