• Changing text between square brackets

    Locked
    4
    0 Votes
    4 Posts
    3k Views
    guy038G

    Hi, @scott-sumner and All,

    Ah, yes, Scott, using named capturing groups is a solution for documented regexes. But there a nice other way to get correct regexes, with a lot of comments !

    I tried to rewrite your S/R, with named groups, using the following template :

    SEARCH :

    (?x) (?-i) # The search is NON-insensitive ( => Sensitive ! ) \[ # A single opening square bracket ( ESCAPED as special char. ) ( # Beginning of group 1 ( First Name ) [A-Z] # A single capital letter [a-z]+ # A NON-null range of lower-case letters ) # End of group 1 , # A single comma character ( # Beginning of group 2 ( FL separator ) \x20|\r\n # A single space character OR the TWO Window End of Line characters ) # End of group 2 ( # Beginning of group 3 ( Last Name ) [A-Z] # A single capital letter [a-z]+ # A NON-null range of lower-case letters ) # End of group 3 (?: # Beginning of an OPTIONAL, non-capturing, group ( # Beginning of group 4 ( MI separator ) \x20|\r\n # A single space character OR the TWO Window End of Line characters ) # End of group 4 ( # Beginning of group 5 ( Middle Initial ) [A-Z] # A single capital letter ) # End of group 5 \. # A single dot character ( ESCAPED as special char. ) )? # End of the OPTIONAL group 5 \] # A single ending square bracket ( ESCAPED as special char. )

    Unfortunately, this way of writing does NOT work in the replacement part :

    # The replacement part CANNOT be split in SEVERAL lines !! # # \3, # Last name is written first, followed by a comma # \2 # Then, we add the FL separator # \1 # Then, the First name is written # ?5 # And if group 5 ( Middle Initial ) exists : # \4\5 # We rewrite group 4 ( MI separator ), followed by group 5 ( Middle Initial )

    => REPLACEMENT :

    \3,\2\1?5\4\5

    Now :

    Select all the lines of the SEARCH part, above, between (?x) and \]

    Copy them, in the clipboard, with a Ctrl + C shortcut

    Paste, first, this selection, in your current file, with a Ctrl + V shortcut

    Re-select this text, representing the search part

    Open the Replace dialog ( Ctrl + H )

    Paste the correct replacement regex, above, in the Replace with: zone

    Select the Regular expresion search mode

    Click on the Replace All button

    Et voilà !!

    Notes :

    Once the search part selected, DON’T copy this selection in the clipboard, for further pasting, in the Find what: zone, of the Replace dialog ! Simply, open the Replace dialog :-) : The selection will be filled in the Find what: zone, automatically :-)

    The syntax (?x) syntax MUST begin the subsequent lines, of the regex. This modifier starts a free-spacing and comment way of writing regexes, with a # character, beginning the comment part

    As, in this mode, the space character is simply ignored, if you search for a space character, you’ll have to use one of the three following syntaxes : \ , [ ] or \x20

    Best Regards,

    guy038

  • Aligning Columns

    Locked
    2
    0 Votes
    2 Posts
    10k Views
    dailD

    As you’ve found it, it is hard to adjust how it looks without changing the data itself. About your only option would be to use tab characters. If you are able to use tabs, then you can use the ElasticTabstops plugin (available through the plugin manager) so it will show your data like this for example:

    Your file itself won’t get changed at all.

  • 0 Votes
    11 Posts
    5k Views
    PeterJonesP

    @Richard LaJoie,

    Maybe this will help explain what @Claudia-Frank has been trying to say: In order for us to help you figure out what’s wrong with your UDL, you would need to show us an example of a file that you want highlighted, and show us what’s not being highlighted correctly.

    What we would need would be a screenshot like

    That one actually shows a C-program, with Language > C > C selected; it shows “C source file” in the lower-left to indicate that’s the language selected. And looking at the screenshot, you can see the #include in different color than the (), and the "Hello, World" in a different color than printf. If this were you screenshot, the lower-left would show “User Define File - Minnekraft”, and the text would be whatever would be expected for “Minnekraft” text (source code or data or whatever you are trying to highlight in the Minnekraft-type file). You would then describe what was wrong with the highlighting shown in the Minnekraft file.

    Instead, you have shown us something like this:

    You have an empty text file. There is nothing for the Language Syntax Highlighter to highlight (it’s empty), so we cannot tell you what’s going wrong. In my second example, I have told Notepad++ that my empty document is C. That’s nice and all, but since there is no text (C or otherwise) in the file to highlight, selecting the C language does nothing, because there’s nothing to highlight. The confusion Claudia has expressed is that all you’ve shown us is a blank document, and it seems to her (and to me) that you are expecting a blank document to be highlighted, which makes no sense to us.

    The extra screenshots you showed of your UDL definition would be somewhat useful, but not without also giving us an example Minnekraft file, showing how it doesn’t get highlighted properly, and explaining how you think it should be highlighted.

    That is the screenshot Claudia has been asking for. To embed an image so we can see it without clicking, use the Markdown Syntax shown below (Markdown is used by this forum to enter your questions):

    ![](http://i.imgur.com/Uercm86.png)

    Note that it’s similar to the normal link syntax, but with an exclamation point ! before the [](http://i.imgur.com/Uercm86.png). This code inline in my post embeds the second image I used above.

    Also, to help us help you, you might want to give us the raw text of an example Minnekraft document. To do that, use Markdown’s code syntax, which requires teh code to be indented by four spaces. To show us an example of Minnekraft file, such as the following:

    This is my indented example of Minnekraft text

    You woud use

    Here is your initial question text This is YOUR indented example of Minnekraft text, indented 4 spaces compared to your question text And here is further question text, no longer indented

    Make sure it’s a short example, because there isn’t a huge amount of space in one post in this forum.

    And since the screenshots of a UDL aren’t always sufficient (your shots don’t say what formatting you’ve chosen for each item, for example), you could use: Language > Define Your Language, then select Minnekraft from the dropdown of the UDL interface, then click Export and save the file, then paste the text of the file (indented an additional 4 spaces) in your question.

    With all of that, we could grab your short Minnekraft file, we could import your UDL’s XML definition, and we could experiment to help you figure out what’s going wrong.

    But for now, all we can say is, “of course nothing’s being highlighted; your document is empty, and there’s nothing to highlight”. But I doubt you’d find that helpful.

  • Problem with ? -> "Set Updater proxy..."

    8
    1 Votes
    8 Posts
    17k Views
    Demian AndradeD

    Permission issue. Just run C:\Program Files (x86)\Notepad++\notepad++.exe as administrator (right click, run as admin.) and it will keep the proxy settings.

  • N++ overwrote and destroyed my file

    Locked
    3
    0 Votes
    3 Posts
    2k Views
    Tin KosicT

    Is there anything I can do given that I’ve not yet closed Notepad++? Is it possible it still has the file saved somewhere in cache or working memory?

  • own language: handling for special characters

    Locked
    3
    0 Votes
    3 Posts
    2k Views
    Jan KischelJ

    Sorry, I don’t quite understand what you are trying to do.

    Basically, I try to make a special kind of log file more readable using the user defined language feature.

    I want to utilize the folding feature as my log file contains some sessions I want to ‘group’. It the same as an

    if { code here }

    block in JavaScript.

    Now, imagine “starting ‘foo!bar’, version” instead of “if” as starting mark. I added ! ’ " * # \ / _ - + : ; into my operators, but doesn’t work.

    Or, to be more clear:
    I want NPP to and handle every line as a stupid raw string, no matter what characters are in it.
    (alternatively, a nice regex would be welcome, but NPP doesn’t support regex in keywords, I guess due to performance.)

  • Help with user defined language

    Locked
    2
    0 Votes
    2 Posts
    1k Views
    Jim DaileyJ

    @Wilux-D
    Try adding the various types of brackets to the operators group.

  • Copying content of an Excel column to XML in Notepad++

    20
    0 Votes
    20 Posts
    14k Views
    Bart HooglandB

    Hi Claudia,

    I’ll keep it as it is then :). Cheers!

  • save folder

    3
    0 Votes
    3 Posts
    2k Views
    Michał SobeckiM

    @Claudia-Frank
    thx so much!

  • Why has the NppShell_06.dll extension DLL an internal 2014 timestamp

    Locked
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Saving multiple files at once into a different folder?

    Locked
    3
    0 Votes
    3 Posts
    4k Views
    Eduardo PlanasE

    Yeah Autosave 2 works, thank you very much, you are awesome saved me a lot of time.
    Have a good day.

  • 0 Votes
    2 Posts
    3k Views
    Claudia FrankC

    @Felipe-Martin

    the scintilla control, the area in which you really type, provides 5, so called, margins.
    Margins are the the area with the numbers displayed, the folding area or the area which
    containing the bookmark signs.

    Every margin can be configured independently if you use a plugin which exposes the scintilla features.
    Plugins like Python script, lua script, nppexec … and notepad++ (although it doesn’t provide all features to be modified).

    Lexers, like the one which can be selected from the language menu, do also modify the margins
    to their benefit. So one lexer might show a folding margin whereas another doesn’t.

    That makes it a little bit difficult to reconfigure the margins to your need because
    it might get overwritten once you select a new/different language.

    If you still want to try out how it works and if it can be modified to your needs and you have
    already one of the mentioned plugins installed let me know.

    Cheers
    Claudia

  • Best Language for Notes/ToDo List for Notepad++

    14
    0 Votes
    14 Posts
    17k Views
    Claudia FrankC

    @SEXY_Coder

    Is there a way or plugin, to turn on autocompletion for the whole Dictionary,

    Yes and no.
    No, because afaik, there is no plugin which can do this and the plugins in questions
    (spell checkers) work differently, meaning they provide a hint that a word has been misspelled.

    Yes, in general, the autocompletion works in the following way.
    It reads/caches what has been written in current document already and by reading an
    api file, if there is one for the language currently used.
    So in theory you can create an api file for your language which contains the dictionary.
    I’m currently not sure how big such a file can be and how good the performance will be
    as this isn’t really the scope of scintilla and notepad++.

    Cheers
    Claudia

  • Imported all on one line

    Locked
    3
    0 Votes
    3 Posts
    7k Views
    Vaughan DaviesV

    Thanks Claudia, that worked perfectly.

  • copying text in search result

    Locked
    3
    0 Votes
    3 Posts
    4k Views
    Nuno AnjosN

    Yes, the Ctrl+C shortcut does what I want
    Many thanks for your reply!
    Nuno

  • Windows SFC logfile creator issue

    Locked
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Escaped back-ticks treated as unescaped in syntax highlight

    Locked
    1
    0 Votes
    1 Posts
    994 Views
    No one has replied
  • Poorman regex based styler/lexer

    16
    4 Votes
    16 Posts
    11k Views
    guy038G

    Hi, @claudia-frank,

    Oh yes, I just forgot that your script acts, exactly, like your RegexTesterPro.py script. This just proves that I haven’t studied your excellent regex’s tester script, since a long time !!

    Concerning the second point, I do understand your explanations. To be honest, right after changing the extension to .py and before restarting your script, I already thought that this change could lead to some unpredictable results :-((

    Cheers,

    guy038

  • Notepad++ stopped working, Windows 7

    Locked
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    8 Posts
    4k Views
    MAPJe71M

    @bookwyrm12

    Well actually two levels: class and method/function (using C++ terminology); With a pull-request for the Notepad++ GitHub repository or I could add it to my Function List Update 3.

    I get: