• How do I search for <Iron>X</Iron> when X could be any number?

    Locked
    2
    0 Votes
    2 Posts
    829 Views
    Scott SumnerS

    @JasonC

    Does the “JSON file” part of this have any real significance?

    Find what zone: <Iron>\d+</Iron>
    Search mode: Regular expression

    \d means any digit character (0-9)
    + means one or more of what precedes it
    so in summary \d+ means one or more digits

    For more, see this.

  • Join Lines that are breaking

    16
    0 Votes
    16 Posts
    4k Views
    Scott SumnerS

    @PeterJones

    Also, @Scott-Sumner was thinking about turning this old post into an entry on our FAQ Desk, but apparently hasn’t found the Round Tuit™ yet.

    I have begun getting “roun-tuit” but until it is in a form that has at least as much value as the old post there is little value in publishing it. It’s a time-available thing…if you have time, you are of course free to make it way better than I ever could–I’d gladly delete my in-progress draft if something good by someone else magically appears as a FAQ Desk posting. :-)

  • Enabling Synchronize Vertical and Horizontal Scrolling

    Locked
    2
    0 Votes
    2 Posts
    26k Views
    Scott SumnerS

    @Tom-Sawyer

    Right-click the tab of one of the desired files and choose Move to Other View. Then, click the tab for the other file. Now both files should be active, but in two different views. If they are one-on-top-of-the-other instead of side-by-side, right-click the border between them and choose one of the options in the little box that pops up. After that the two files should be side-by-side. And the Synchronise menu options should be enabled.

  • Highlight, Language, Style - hit or miss

    Locked
    2
    0 Votes
    2 Posts
    856 Views
    Eric BurkeE

    I figured it out. The quotes were somehow changed to curly quotes and listed as delimiters. Sorry about that oversight…

  • Plugins menu not sorted alphabetically

    Locked
    2
    0 Votes
    2 Posts
    876 Views
    Scott SumnerS

    @Rick-Pugh

    Already discussed by @dail in this thread.

  • Ctrl+A, then Shift + Mouse Click - unwanted behaviour

    Locked
    5
    0 Votes
    5 Posts
    2k Views
    guy038G

    Hi @dail,

    I’m sorry ! In my previous post, I just forgot to thank you for your… future reply ! So, I do ;-))

    Cheers,

    guy038

  • Batch replacement of string occurence by their replacement string

    9
    0 Votes
    9 Posts
    5k Views
    Scott SumnerS

    @guy038

    Well, yes, that occurred to me as well, initially…but then I assumed that possibly the OP’s word list was going to be too long to fit the 2046 (or is it 2047) character limits of the Find what and/or Replace with fields. Of course, if it is too long, potentially it could be done in batches…

  • Bug report about Word Wrap.

    Locked
    1
    0 Votes
    1 Posts
    556 Views
    No one has replied
  • Sorting multiple chunks of non-connected text

    9
    0 Votes
    9 Posts
    3k Views
    Jeff TestJ

    That was utter brilliance @guy038 . I, i can’t even. Hats off on that.
    (This is not to say that the py script from @PeterJones is out the window, this will just help me convince folks that Notepad++ is the best.) :)

    +++Unrelated+++
    So, is there a book, like NoStarchPress or something for Notepad++? How did you learn all these fancy bits for the regex? (its Perl?)
    Python vs. Perl? (I’d like to learn one, or both. My aim is system administration/automation. Recommendations?)

  • Replacing Tidy plugin

    3
    0 Votes
    3 Posts
    5k Views
    PeterJonesP

    Nope, never used it. When I want to manipulate the text with an external utility, I tend to use NppExec or PythonScript plugins.

    What did you try before you asked the question? Have you tried anything in the month since then? What works, what doesn’t? (People in help forums usually like seeing that you’ve put in effort yourself. Besides, it helps them reproduce your problem, and gives a good starting place for where to go next.)

    However, even though I’ve never used it, I took a 2minute look at the pork2sausage.ini, and it comes with pretty good documentation in the comments section. Here’s how I understand the parameters, after those 2 minutes:

    progPath: full path to the executable you want to run. He used the example of java.exe, but that’s where you’d give the full path to tidy.exe (or whatever Tidy’s executable is called) progCommand: the command you wanted to run. He used an example of calling a specific java class, but you would use something like tiny --option 1 -- something else "$(SELECTION)" workDir: what directory do you want it to run in progInput and progOutput: if you have whole files you want to use, this is where you’d specify them. But that’s if tidy were expecting filenames, and could not handle command-line arguments.

    I know nothing about the tidy executable, so let’s pretend I had a program called transform which takes as its argument a single string, and outputs some transform of the string on STDOUT. My .ini would be something like (untested, since I’ve never used pork2sausage, and haven’t downloaded it)

    [xfrm] progPath=C:\Program Files\TransForm\transform.exe progCmd=transform "$(SELECTION)" workDir=C:\Program Files\TransForm\

    You would then select some text, and run the pork2sausage using “xfrm” (I don’t know how to do that part; presumably, Plugins > Pork2Sausage > xfrm).

    Given that tidying HTML probably wants the whole file, rather than a small selection, and passing newlines over the command line is difficult, you’d be more likely to want the progInput / progOutput version: but then you’d need to always save the file to whatever’s defined in progInput. But at that point, I’d probably switch to NppExec, with something like this command, which I use to take the entire contents of the currently active file, encrypt it using gpg.exe, and paste it back into the active document (and save):

    cls npp_save cmd.exe /c exit %RANDOM% // cannot access $(SYS.RANDOM) directly through NppExec, but can tell cmd.exe to return it as a value set tempfile = $(SYS.TEMP)\NppGpgFile_$(EXITCODE).tmp // create random tempfile name set ascfile = $(SYS.TEMP)\NppGpgFile_$(EXITCODE).asc // create associated ascfile name sci_sendmsg SCI_SELECTALL // select all sel_saveto $(tempfile) :a // save selection to the tempfile (use :a to save as ansi, to prevent unicode prefix ÿþ getting embedded) INPUTBOX "Recipients (use -r between multiple): " : email@address // get the recipients gpg.exe --output "$(ascfile)" -ase -r $(INPUT) "$(tempfile)" // armor+sign+encrypt to recipient(s) sel_loadfrom $(ascfile) // replace selection with results sci_sendmsg SCI_DOCUMENTSTART // deselect //rm -rf "$(tempfile)" "$(ascfile)" // cleanup temp files npp_save
  • How convert accents and others chars to utf8

    Locked
    2
    0 Votes
    2 Posts
    1k Views
    crystalfpC

    Do you mean your file contains a mixture of utf8 and non-utf8 characters?
    Have you tried to convert the file encoding to the one of your non-utf8 characters and then back to utf8?
    Hope it helps. mario

  • Scroll screen not getting the cursor to bottom or top

    2
    0 Votes
    2 Posts
    1k Views
    Mikhail VM

    Yes. There are Scintilla commands to set this.
    https://www.scintilla.org/ScintillaDoc.html#ScrollingAndAutomaticScrolling

    This one is needed:

    SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)

    Though I am not sure how to make it auto-run in NPP directly.
    I only know how to do it using the PythonScript plugin.
    https://github.com/bruderstein/PythonScript

    If you have it installed, then open “startup.py” script and put these lines
    somewhere in the bottom:

    editor.setEndAtLastLine(0) editor.setYCaretPolicy(13, 5) # set scroll offset to 5

    Also set “Initialization: ATSTARTUP” in the plugin Configurarion menu.

    This will set scroll offset to 5 lines (so change 5 in the second line to something else if needed).

  • Replacing partial lines

    Locked
    3
    0 Votes
    3 Posts
    1k Views
    guy038G

    Hello, @donny-tee, and All,

    If all your lines, beginning with the number 23, follow the same template, that’s quite easy, my President !

    SEARCH (?-s)^23\x20.+

    REPLACE 23 -0.308254 -0.007814 0.307166 -0.110578 -0.404637 -2.460353

    Notes :

    First, the (?-s) modifier means that the regex dot symbol (. ) matches a single standard character, only ( and not an EOL char )

    Then the part ^23\x20 matches the number 23, followed with a space character ( you may replace \x20 with a true space )

    Finally, the part .+ ( or .{1,} ) matches the non-empty remaining of each line, beginning with the number 23

    Best Regards,

    guy038

    P.S.

    It would be nice, President, if all your problems could be solved, in a similar way ;-)) Peoples and planet would just go on, living in peace !

  • Help locating a letter and number string

    Locked
    5
    0 Votes
    5 Posts
    1k Views
    guy038G

    Hello, @angela-davis

    Assuming there is NO condition on the choice of lines, this following regex S/R swaps, for instance, the next 2 lines till the final block of two lines of the current file

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

    REPLACE \2\1

    So, given the sample text, below, with the cursor located before the string 1A :

    1A This is a 1B simple text 2A in order to 2B understand 3A how the 3B text changes

    You should get :

    1B simple text 1A This is a 2B understand 2A in order to 3B text changes 3A how the

    Best regards,

    guy038

  • Problem using Spell-Check + Aspell

    2
    0 Votes
    2 Posts
    678 Views
    Terry RT

    It sounds like you are trying to get the dictionary to “learn” new words. This would entail it opening and writing to a file. If this is the first time you’ve tried this (as you say) the error probably means it’s not even able to create the file, hence why you cannot find the file.

    So look for the “Aspell” folder, that’s part of the error message you get, hopefully some other files already exist there. Using an external program (Windows Explorer maybe) attempt to write a text file in that folder, you will probably get a similar error message, “unable to create file”. If that happens it will prove it’s not a Notepad++ issue, rather a Operating System permissions problem which will need fixing/adjusting.

    Terry

  • Regex: Select all the words that doesn't have . in front of

    Locked
    3
    0 Votes
    3 Posts
    848 Views
    Vasile CarausV

    Got it.

    FIND: \w+([^.#"</ ])(?=html)

    this will find all words html that has only letters before it, such as my-babyhtml

    will not match words like #html or <html or "html

  • SCORM File Editing

    Locked
    3
    0 Votes
    3 Posts
    1k Views
    Brandon ChavezB

    Outstanding advice! I was assuming it had something to do with the format I was editing it, eg: UTF-32, UTF-16 or ASCII formats. I tried a few with no luck. I will do as you say and see if there is a difference in the files after editing the two utilizing Notepad vs. Notepad++. I also assumed that the SCORM manifest was checking file size as well, however I couldn’t find any evidence of that happening, plus that wouldn’t make sense that I could edit with Notepad without any issue.

    I appreciate your response, will definitely do this!

  • Language not being saved with file

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    PeterJonesP

    NPP does not save a per-file language-lexer choice. The lexer used is determined by the extension lists in the settings for each Language > Define your language... > Ext : (for a given User Defined Language, UDL), and in the Settings > Style Configurator > User ext. and Default ext. (for a given Language lexer).

    A User ext. in the Configurator or an Ext. : in the UDL settings will override a Default ext.. If an extension isn’t found in the user extensions or UDL extensions, NPP will search the default extension lists, and hand the file off to the appropriate lexer, if found. If an extension isn’t in any of the lists, then it will be handled as a Normal text file.

    So, if you’ve set Ext. : = txt in the User-Defined Language AutoHotKey, then NPP will use the AutoHotKey UDL for the highlighting whenever you open a .txt file, rather than going thru the list of priorities down to the Normal text.

    If you don’t want NPP to apply the AutoHotKey formatting to .txt files, you have to make sure that you remove txt from the User-Defined Language settings for the AutoHotKey (and any other user-defined language or style-configurator language).

    If you want NPP to apply AutoHotKey to some .txt files, but Normal Text to others, that’s more than NPP is programmed to do. You will have to toggle some of the .txt files manually; or you might be able to figure out a way to program a PythonScript or LuaScript to recognize the specific content when a .txt file is opened, and to have the script tell NPP to either use the AutoHotKey highlighting or Normal Text…) Notepad++'s expectation is that files that want different highlighting will have different extensions (so maybe choose .ahk for AutoHotKey files – though, since I don’t know how AHK works, I don’t know if it has a default file extension, or whether it doesn’t care, or whether it only accepts .txt files).

  • php additional syntax highlighting

    Locked
    2
    0 Votes
    2 Posts
    1k Views
    PeterJonesP

    What categories there are available for a given language are defined by that language’s lexer; unfortunately, you cannot add new categories. (Well, like you saw, you can add anything you like to stylers.xml… but if the php lexer isn’t programmed to match words in that category, and to pass on the category to scintilla to mark it with a particular style, nothing will happen.)

    Many of the languages allow adding new keywords to a given category; in php, if you wait long enough on the WORD style, it pops up the default and user-defined keyword lists, so you could add words to that category – however, I don’t see that it’s implemented any other styles of keywords.

    So, with the builtin lexer, I don’t think you’re going to be able to add a separate style/category of keywords, sorry.

    You might be able to come up with a UDL to highlight the words as you desire (but UDL highlighting often falls short in areas that the custom lexers excel in, so you may have to give up something in order to get the two different categories of keywords).

  • I need help trying to run Python in Notepad++

    Locked
    1
    0 Votes
    1 Posts
    885 Views
    No one has replied