• Help with the construction of a regular expression

    4
    1 Votes
    4 Posts
    377 Views
    GrafG

    Thanks for the tips. Especially for the link with examples of text search in a separate zone. I broke my head, but I found my own option.

    (?-si:<connection connection=".+\n.+class="ship.+owner="player".+\n|(?!\A)\G)(?s-i:(?!<\/people>\n).)*?\K(?-si:(<skill.+\n)+)

    But another problem has emerged. as I understand it, due to the large file size (~500 MB and ~13.5 million lines) I get an error if there are about 1 million lines between the areas with the data I need. That is, for example, I search first class="ship.+owner="player" throughout the file and get a normal result - 32 matches in the entire file.

    b9631a07-3395-4af8-8d1b-986b63a77044-image.png

    But if I try to execute my regular expression from the beginning of the file, there will be a regular expression error message (invalid regular expression).

    If i place the cursor inside any of the zones and use marks, then all the matches from all the zones will change if, as I found out, there are less than 1 million lines between them.

    Or if i place the cursor inside the zone with the desired text (but after which, the next zone of interest will start after at least a million lines) and sequentially perform “find next”, then the search will continue normally until it reaches the </people> tag, after which, as I understand it, the search should begin the next zone, however, will again receive a regular expression error message.

    I tried to find out what the error is on various online resources for checking regular expressions, but they can’t cope with such a volume of strings. I also did not find offline tools for such a task, maybe I was looking for it badly.

    And as I understand it at the moment, the problem is not in the regular expression itself, but in the limitation of the search engine. Maybe someone has come across something like this or knows a suitable tool?
    At the moment, I’m thinking about trying to write something suitable for this task in python.

    P.S. How can I hide anything under the spoiler?

    P.P.S. X4 foundations let me go, I’ve been racking my head for the second week))

  • Replace tab spaces only inside quotations.

    4
    0 Votes
    4 Posts
    325 Views
    guy038G

    Hello, @uhax-the-grey, @coises and All,

    Your solution, @coises, seems to work only if :

    A single "......" section exists in current line

    Line-ending char(s) end(s) the current line

    @uhax-the-grey, the difficulty to achive that general goal is that the ending char of a section is the SAME char than its beginning char ( the " character ) :-((

    So I propose to split the problem in 3 successive steps :

    First, we change any couple of " chars, of a single section, with two different control chars ( \x02 and \x03 )

    Secondly, we use the generic regex mechanism, described here, to replace any \t character by a space char, in "............" sections only

    Finally, we restore the two original " delimiters for each section

    This method leads to the 3 successive regex S/R below :

    SEARCH (?s)"(.*?)"

    REPLACE \x02\1\x03

    Then :

    SEARCH (?:\x02|(?!\A)\G)(?s:(?!\x03).)*?\K\t

    REPLACE \x20

    Remark : Do not forget to move the caret ( cursor ) at the very beginning of the current file, before running this second S/R !

    Finally :

    SEARCH [\x02\x03]

    REPLACE "

    Whatever the position of the TAB chars and the " deleimiters, thoughout the text contents, this method should always work properly !

    Best Regards,

    guy038

  • Put first word in each line in quotes

    3
    0 Votes
    3 Posts
    215 Views
    UHAX The GreyU

    @Ekopalypse That worked, thank you!

  • Pluggin. How readding crurent document Line per Line

    2
    0 Votes
    2 Posts
    159 Views
    CoisesC

    In what language are you writing your plugin?

    What do you have so far?

    The functions you will need are described here and you will probably need at least some of the functions described here. But from your message, I suspect you are not that far along yet.

    Start here and tell us when/where you get stuck.

    If you read that and your reaction is that it sounds far too complicated, it could be that you want to write a script, not a plugin. If you know Python, check out the Python Script plugin for Notepad++.

  • Incorrect color to property css rotate

    2
    0 Votes
    2 Posts
    177 Views
    Mark OlsonM

    @Yamir-Smith
    You can go to the langs.xml file in your application data directory (which is usually AppData/Roaming/Notepad++ but may also be the same directory where your notepad++.exe file lives), navigate down to Keywords name="instre1" element inside the Language name="css" element, and add the word rotate where it belongs in alphabetical order in the long list of keywords there (for me, it has to be between right and rotation).

    If you’re interested, you can open a PR so that this change can be incorporated into Notepad++ permanently. While you’re at it, you can see if there are other CSS keywords that are missing and add those as well.

  • Ctrl+Alt+S Save As... stopped working

    11
    0 Votes
    11 Posts
    1k Views
    M

    I unfortunately don’t have the permissions to run hotkey-detective on this system.

    I’m just going to settle for using Ctrl+Shift+S for Save As…

    Thanks everyone for help!

  • Interactive debugging scripts using PythonScript plugin

    3
    0 Votes
    3 Posts
    463 Views
    Stefano OrlandoS

    @Mark-Olson I already knew that I could use print and other passive mechanisms like logging. I tried with pdb and the script seems to get on break, an error message missing stdin is displayed on the console but I can’t find a way to enter commands for pdb

  • How to ignore certain characters in searches

    3
    1 Votes
    3 Posts
    778 Views
    Amanda HamiltonA

    @PeterJones ,

    Thank you very much! That does indeed work. I have also heard back from the CLAN developer, who suggests I could use a CLAN program to generate long tiers–but it does make things very hard to read in CLAN. Your solution is probably better. Thank you!!

  • How to run it with Google Web pages

    8
    0 Votes
    8 Posts
    675 Views
    최민정

    @mkupper

    Thanks a lot.

  • 0 Votes
    3 Posts
    218 Views
    Talbot TeboeT

    @Talbot-Teboe
    Sorry I didn’t realize that I needed to include lines without the /001
    In my attempt to create the expression I was not even close. I didn’t even get the last group of the expression correct
    I’d been manually searching for the lines without the /001, and had been at it for 3 hours before contacting the Community.
    Thank you very much for the assistance

  • @admin. how to fix "you need 1 reputation to post links" message

    4
    1 Votes
    4 Posts
    288 Views
    PeterJonesP

    @A-Notepad-User said in @admin. how to fix "you need 1 reputation to post links" message:

    i have same problem.

    No you don’t. You just clicked “quote” to reply, and it posted successfully.

    The issue described above (that the forum wouldn’t let you “quote” a reply if you have 0 reputation, because the @-mention and link-to-previous-post) was fixed when we upgraded forum software a few months ago. It is obviously fixed and working for you, because your post includes both the @-mention and the link-to-previous-post.

    If you have 0 reputation, you are still not able to link to external sites, to prevent spambots and other manual spammers. But other than that, 0 reputation can still post and reply without difficulty.

  • How can i get that grouping

    2
    0 Votes
    2 Posts
    258 Views
    Terry RT

    @Matiasoskari said in How can i get that grouping:

    i wonder how can i get grouping like that?

    It’s called folding. The online manual reference is here.

    It primarily works with “defined” programming languages (lexer file contains the necessary definitions to aid the folding). However you (the user) could also create a UDL. So in order that you can use folding in your file there would need to be a structure to the file contents, such as headings, paragraph start ID’s and the likes.
    Have a read of the process in the online manual’s link and see if it might work for you. The UDL system isn’t as mature as the lexer folding is, and you might encounter an issue creating your UDL. Be aware that others have also found bugs in the UDL system, but in spite of these being raised with the developer none have been fixed (as yet), reference.

    Other posts here with relevance.
    https://community.notepad-plus-plus.org/topic/25543/i-want-to-fold-in-text-files
    https://community.notepad-plus-plus.org/topic/25389/add-folding-rules-to-an-existing-language/3
    Use the text folding in the search window to find other posts which might have some relevance to your post.

    Terry

  • UDL 3 different colors for 3 similar delimiters

    3
    0 Votes
    3 Posts
    339 Views
    J

    @Mark-Olson , you solved it and it works great.

    It did not occur to me that the order would matter.

    Thanks for sharing your cleverness!

  • Problem in CSS alignment in same line . css not working

    Locked
    4
    0 Votes
    4 Posts
    461 Views
    Alan KilbornA

    @Zain-Khan

    The original query was a non Notepad++ related question.
    Please don’t answer those type of questions, it only encourages people to ask any kind of question here, when we want to focus on Notepad++ discussion.

  • Search for inconsistent line endings with a regex? (part 2)

    29
    3 Votes
    29 Posts
    5k Views
    guy038G

    Hello, @ekopalypse, @alan-kilborn and All,

    I did some additional tests, with your modifications, Alan :

    line_of_first_mismatch = editor.lineFromPosition(match.span(0)[0]) notepad.messageBox('Different EOLS detected -- the first inconsistency is on line ' + str(line_of_first_mismatch + 1),'EOL Mismatch', 0)

    and my own one :

    false_EOL = {0:'$\n|\r^', # Find \n AFTER end of line OR \r BEFORE beginning of line as editor.getEOLMode() = 0 ( Windows EOL )

    And everything seems to work as expected !

    So the final version of this script is :

    check = True false_EOL = {0:'$\n|\r^', # Find \n AFTER end of line OR \r BEFORE beginning of line as editor.getEOLMode() = 0 ( Windows EOL ) 1:'\n', # Find \n ( should be \r ) as editor.getEOLMode() = 1 ( Macintosh EOL ) 2:'\r', # Find \r ( should be \n ) as editor.getEOLMode() = 2 ( Unix EOL ) } def check_eol(match): global check check = False line_of_first_mismatch = editor.lineFromPosition(match.span(0)[0]) notepad.messageBox('Different EOLS detected -- the first inconsistency is on line ' + str(line_of_first_mismatch + 1),'EOL Mismatch', 0) user_input = notepad.prompt('Convert ALL line-endings of CURRENT file ( 0 for CRLF, 1 for CR, 2 for LF )', 'INCONSISTENT line-endings DETECTED !', editor.getEOLMode()) if user_input is not None: desired_eol_index = int(user_input) if 0 <= desired_eol_index <= 2: eol_cmd_list = [ MENUCOMMAND.FORMAT_TODOS, MENUCOMMAND.FORMAT_TOMAC, MENUCOMMAND.FORMAT_TOUNIX, ] if desired_eol_index == editor.getEOLMode(): notepad.menuCommand(eol_cmd_list[(desired_eol_index + 1) % 3]) # change to UNDESIRED line-endings notepad.menuCommand(eol_cmd_list[desired_eol_index]) # change to DESIRED line-endings editor.research(false_EOL[editor.getEOLMode()], # regex to search for check_eol, # function to call if regex match 0, # re flags 0, # START of file editor.getLength(), # END of file 1) # count ( at FIRST match ) if check == True: notepad.messageBox('All EOLS correct','EOL check', 0)

    To be rigorous, note that the first EOL inconsistency is always the first line with line-ending chars(s) different from the status bar indication !

    Best Regards,

    guy038

  • Macro Menu commands and the Context Menu

    7
    1 Votes
    7 Posts
    556 Views
    Alan KilbornA

    @Jim-Dailey said in Macro Menu commands and the Context Menu:

    And, as you have pointed out, even if they are on the Macro Menu, the context menu doesn’t “see” them there, but rather on the NPP Exec Menu.

    It’s a bit odd, because when they are configured to be on the Macro menu, they don’t appear on the NppExec plugin menu, so I’m not sure how they’re actually found. Curious.

  • f5 run...go to next line or next character?

    5
    0 Votes
    5 Posts
    400 Views
    ddalthorpD

    @PeterJones Almost certainly true. Thanks. npptoR has not been updated since 2016.

  • Header plugin

    4
    0 Votes
    4 Posts
    462 Views
    Aleksandr ShchepkinA

    Friends, you’ve helped me so much, I’m so happy. I have a txt file with more than 16000 lines, size 1,6 mb. I created an xml file in the functionList folder with the following code:
    <NotepadPlus>
    <functionList>
    <parser displayName=“XML” id=“xml”>
    <function
    mainExpr=“#([^#<]+)”
    displayMode=“$functionName”>
    </function>
    </parser>
    </functionList>
    </NotepadPlus>

    And indeed now, I have a set of headers displayed on the right (the headers start with the # symbol).
    The file is constantly growing, so far everything is working very well, thanks.

  • I can't save it... help me plz...

    2
    0 Votes
    2 Posts
    177 Views
    PeterJonesP

    @parkyungmin ,

    Sorry. I could not reproduce it. “Save” and “Save As” work for me.

    ----

    Why such a short reply? Because you didn’t tell us enough to be able to reproduce your problem, or because I tried what you described and got the results I expected. If you give us more information, we might be able to help more. Especially important are the ? menu’s Debug Info contents, a thorough description of the steps necessary to reproduce your problem.

  • Forced font antialiasing and Courier is not what it should be

    8
    0 Votes
    8 Posts
    530 Views
    Jean-Claude ArbautJ

    @Alan-Kilborn

    Actually, as long as the option is still there it’s fine. But it was surprising, as there is also an antialiasing option in the Editing pane, so I didn’t expect another option to cover this (and I rarely look at the Misc pane anyway).

    I guess whatever the enhancement, there will always be someone who doesn’t like it. ;-) I have myopia, and I see blurry enough, so I like my screen characters to be as sharp as possible. While it may not be a common concern, I’m sure I have seen folks with the same preference on the Internet from time to time, as my antialiasing problem is not new nor limited to Npp - Windows and other programs have not always been reliable for this either. Even on Linux, I tend to prefer xterm over the more modern terminals for the same reason. I’m in the anti-antialiasing team!

    Many thanks to all,

    JCA