• How to remove multiple lines?

    2
    0 Votes
    2 Posts
    5k Views
    PeterJonesP

    @Sameh-El-Desoki ,

    Welcome to the Notepad++ Community Forum. I will append some useful generic information at the end of this post for how to ask your question in a way that will improve the quality of answers that you get, and provides links for how to learn how to do the fancy search/replace on your own rather than relying on us. Avail yourself of that advice.

    I will do my best to answer based on the information you have given.

    You will want to use the “regular expression” search mode.

    Your first request said,

    I want to delete lines containing https://***:2083

    The notation you gave was very nearly the regex expression needed for mathcing that portion. .+ will match 1 or more of any character. If you restrict it to “as few as possible”, .+?, then it will go from the https:// to the first :2083 in the match.

    Then, all you have to do is add the regex syntax for grabbing the first part of the line and last part of the line (including newline or end of file), and bring it all together

    FIND = ^.*?https://.+?:2083.*?(\R|\Z) REPLACE = empty Search Mode = regular expression Uncheck . matches newline REPLACE ALL

    Translates:

    keep https://bnasicoasdasasdasfo.biz:2083|cthakzzq|Ch3 keep https://bnasfasfasdaso.com:2083|vichlvcl|Ch keep https://bodasdasdasdlutions.com:2083|hd keep

    into

    keep keep keep keep

    if possible want to delete lines containing . like domain.com or domain.net

    To match a literal . character in a regex, escape it like \.

    So the pattern will be start-of-line, 0 or more chars, literal ., 0 or more chars, end-of-line/end-of-file

    FIND = ^.*?\..*?(\R|\Z) REPLACE = empty Search Mode = regular expression Uncheck . matches newline REPLACE ALL

    translates

    This line has no dot This ends in dot. .This started in dot domain.com domain.net no dot

    to

    This line has no dot no dot

    Please note that better examples, with lines to delete and lines to keep, would help us confirm the regex works before we post our answer, rather than you having to tell us, “no, I really meant xxx”.

    Please note that this forum is not a “do my data transformation for me”, or even a “generic regex help forum”. We will give new users a couple of rounds of regex help, but really, this forum is about so much more than just “make my data change from X to Y”. You will get better help if you show an effort and willingness to learn.

    ----

    Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as literal text using the </> toolbar button or manual Markdown syntax. To make regex in red (and so they keep their special characters like *), use backticks, like `^.*?blah.*?\z`. Screenshots can be pasted from the clipboard to your post using Ctrl+V to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get. Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.

  • Switch to next file in Macro?

    3
    0 Votes
    3 Posts
    945 Views
    JssampJ

    @PeterJones Indeed that was the key. I was using Control-Tab to switch tabs. I didn’t know about Control-PageDown. Thank you so much. I spent several hours trying to figure that out, even reading the scintilla source from github. Should have come here first but I wanted to do my due diligence.

  • Add Parse Rules to Language None (Normal Text)?

    2
    0 Votes
    2 Posts
    793 Views
    PeterJonesP

    @Robin-Andrews-0 said in Add Parse Rules to Language None (Normal Text)?:

    I have spent a long time trying to get markdown to generate a function list so I can navigate easily.

    Getting the regex right for functionList parsing can be tricky. It’s easier when you’ve just got a function, rather than also having a class… but things that you really think should work don’t always work in practice, and it’s really hard to debug.

    It’s been a right headache and I did not succeed.
    I tried creating a UDL, which I didn’t want to do as I then had to manually define the colours to match my theme etc, and I write markdown as plaintext and want no highlighting.

    You can define a UDL that has nothing more than a name, and no other formatting. Well, I guess, as you said, if you are not using the default theme then you’ll have to define the Default style for that UDL to match your theme’s default standard text style; and maybe the number formatting, too. But that’s only a few clicks to get it all set up. And you don’t have to add any keywords or similar

    I persisted though as it looked like there was no other way, but I couldn’t get overrideMap.xml to be read for the UDL…

    I don’t understand why users have so much trouble with this aspect. This has worked the first try, every time for me.

    To the default language (None, Normal Text). Is this possible please? Or is there some simple way to make markdown work with a function list for headings and zero formatting, just like plain text?

    You cannot associate a functionList parser with Normal Text.

    I just unzipped a fresh v8.0-64bit portable to experiment with your situation. But these instructions should work with v7.9.1 and newer.

    Set theme to “Solarized-light”, which has FG=(101,123,131) BG=(253,246,227) Saved a text file called 21302.ra which contains the text# one This is a test ## two 123456789 ### three blah Language > Define Your Language > Define Your Language Folder & Default > Default Style > Styler = FG and BG as with “Solarized-light” Comment & Number > Number Style > Styler = FG and BG as above SaveAs = Markdown Ext. = ra Close UDL editor In 21302.ra, select Language > Markdown: the text file I showed matches the FG and BG of the selected theme Open your overrideMap.xml and in the User Defined Languages section, add<association id= "markdown.xml" userDefinedLangName="Markdown"/> and save Create markdown.xml in the same directory as overrideMap.xml, where the <parser...>...</parser> you showed goes inside the <NotepadPlus><functionList>...</functionList></NotepadPlus> container. Save. Exit Notepad++ application Start Notepad++ application, open 21302.ra. Display Function List panel

    f2d8ea8d-9212-4459-82b9-5b66912c8106-image.png

  • How to Practice Coding on Daily Basis

    2
    0 Votes
    2 Posts
    255 Views
  • Dark mode, there's something wrong

    2
    0 Votes
    2 Posts
    158 Views
    dinkumoilD

    You didn’t do anything wrong. Dark mode’s implementation is still incomplete, you have to be patient and wait for a solution in the future. The author of the software is already aware of that issue but decided to postpone working on a solution.

  • Per-tab reload options?

    5
    0 Votes
    5 Posts
    279 Views
  • How to find and delete multiple lines?

    9
    0 Votes
    9 Posts
    473 Views
    guy038G

    Hello, @lagey-raho, @alan-kilborn, @robin-cruise and All,

    Finally, with your raw text, in reverse video, ( thanks for this inpuut ), we now know that all your lines do not contain any leading blank characters !

    So, basically, from your last post, you want to delete any range of lines :

    Beginning with the line Solution:•••••, with this exact case

    AND

    Ending right before a line containing upper-case letters and space characters, ONLY

    OR

    Ending right before a line beginning with a number, immediately followed with a dot char

    OR

    Ending at the very end of current file !

    I assume that it’s better to replace all these deleted blocks with a single empty line to get some kind of separation !

    If so, this following regex S/R, expressed with the free-spacing mode (?x), should work :

    SEARCH : (?xs-i) ^ \h* Solution: .+? (?= ^ (?: \u+ \x20+ )* \u{2,} $ | ^ \d+ \. | \z ) REPLACE : \r\n ( or '\n' only, if your file is an UNIX one )

    Best Regards,

    guy038

  • Regex: Select all non-ASCII characters html tags

    4
    0 Votes
    4 Posts
    441 Views
    Robin CruiseR

    @guy038 said in Regex: Select all non-ASCII characters html tags:

    (?<=<p class=“OANA”><em>)[\x00-\x7F]+?(?=</em>)

    thanks a lot @guy038

  • Macro to copy text to clipboard

    3
    1 Votes
    3 Posts
    715 Views
    Karun PoudelK

    Thanks @PeterJones, that’s insightful. I will try to convert my macro to NppExec commands.

  • Textfile too big - how can I load anyway?

    3
    0 Votes
    3 Posts
    216 Views
    PeterJonesP

    @Thomas-Bastian ,

    Also, I was just reminded there is a “Big Files Plugin” which allows for quick paging in huge files. That may be of some use to you as well.

  • Is there a way to select all marked text?

    2
    0 Votes
    2 Posts
    521 Views
    Alan KilbornA

    @Adrian-Deutscher-Bishop

    There is not…but please tell us what your next step would be (after you’ve selected it).
    There aren’t a lot of options – you’ve rejected copying.

    How about cutting/deleting? Hmm, it may be valid to want to accumulate marked text from several marking operations and then wanting to cut/delete all of it.

    But we don’t know what you’re thinking unless you share it.

  • XML Tools Plugin - Can't get Pretty Print feature to work

    13
    0 Votes
    13 Posts
    9k Views
    Michele DelpianoM

    Some final words just to summarize: my issue with XML Tools Pretty Print feature not working (and making damage in other opened files) was caused by some corrupted NP++ components, probably due to some update installation glitch.
    After a clean reinstallation of NP++ everything was ok, I have been using XML Tools since then and it is doing great.

  • How to hide line numbering?

    3
    0 Votes
    3 Posts
    230 Views
    Weqas WeqasW

    @PeterJones Thank you.

  • User Defined Languages Autosave?

    4
    0 Votes
    4 Posts
    427 Views
    PeterJonesP

    @SPConnol ,

    Unlike certain stack-based help forums, the Notepad++ Community isn’t about “the one true answer”. It’s not even just a help (question + answer) forum. It’s about discussing Notepad++ in all its facets, and helping each other. Thus, there isn’t a “right answer” or “this has been answered” button, because not all discussions have “one right answer”, and often times, the discussions diverge from the original question that started the discussion: and on this forum, that’s all good, and leads toward better discussion.

    Feel free to upvote any contributions that you think were helpful to the discussion, whether they “answered the question” or just added information or insight or a good perspective.

  • How to extract ....

    4
    0 Votes
    4 Posts
    384 Views
    guy038G

    Hi, @martin-huh and All,

    Ah… OK ! So, here is the road map :

    Open your huge file in Notepad++

    Open the Mark dialog ( Ctrl + M )

    SEARCH (?-i)(?<=ECB )\w+

    Tick the three options Bookmark line, Purge for each search and Wrap around

    Click on the Mark All button

    => The appropriate words, which follow the string ECB and a space char should be highlighted in red

    Now, click on the Copy Marked Text button

    Open a new tab ( Ctrl + N )

    Paste the clipboard contents ( Ctrl + V )

    Here you are ! You get the list of all these specific words

    Now, if you prefer the list of all lines containing, at least, one of these key-words :

    Right-click on the Bookmark margin and select the Copy Bookmarked Lines item ( or use the Search > Bookmark > Copy Bookmarked Lines option )

    Again, open a new tab ( Ctrl + N )

    Paste the clipboard contents ( Ctrl + V )

    Notes :

    The in-line modifier (?-i) forces the search to be sensitive to case ( non-ignore case ), whatever you’ve ticked, or not, the Match case option

    The \w+ represents the non-null range of regex word characters to search for

    The (?<=ECB ) is a look-behind structure, so a condition which must be true before the word to match but which is not part of the match ( Note the space char before the closing parenthesis )

    So the overall regex can be expressed, in English language, as :

    Match any word which is preceded by the string "ECB ", with that exact case

    Best regards,

    guy038

  • Beginning letter replacing

    11
    0 Votes
    11 Posts
    646 Views
    kracovwolfK

    I tried tweaking this since I found ones that begin with “L…”, so I tried \bL… but I didn’t realize that the periods act as wildcards so they changed all characters to periods. It changed “Well I can” to “Wel… I can” so obviously my tweak isn’t any good. If anyone has a solution let me know.

  • Config files documentation wrong?

    5
    1 Votes
    5 Posts
    228 Views
    oO0XX0OoO

    Ok, done. Thanks for the suggestion / comment

  • How to move the second line into the last line in the paragraph?

    20
    0 Votes
    20 Posts
    654 Views
    Reza SaputraR

    After hundreds of trying. I m figure out that I can delete some words between two special characters. So that the best I can do, instead of moving into the next line :(

  • How Do I Delete Search Entries?

    36
    0 Votes
    36 Posts
    25k Views
    guy038G

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

    @troglo37 :

    Well, you could have guessed, with a bit of deduction, even if not aware about technical matters !!

    Firstly, look at the four main fields of the Find in Files dialog ( Ctrl + Shift + F ):

    Find what:

    Replace with:

    Filters:

    Directory:

    Secondly, look at the first 4 attributes of the <FindHistory •••••••••••••••> tag :

    nbMaxFindHistoryPath

    nbMaxFindHistoryFilter

    nbMaxFindHistoryFind

    nbMaxFindHistoryReplace

    Isn’t it obvious ?

    Still confused ?

    Then, let’s re-organize these four attributes, like below :

    nbMaxFindHistoryFind

    nbMaxFindHistoryReplace

    nbMaxFindHistoryFilter

    nbMaxFindHistoryPath

    I hope you get it :-))

    Best Regards,

    guy038

  • How Do I Keep Multiple Tabs Saved in Notepad++?

    18
    0 Votes
    18 Posts
    10k Views
    Troglo37T

    @Michael-Vincent I’ve tried all of those. As far as I’m concerned, N++ is better than them. I like it because of the aethectics and various features it provides.

    I began using Bookmarks in my browser as a backup about a year ago, but would never use that as my primary source.

    @PeterJones said in How Do I Keep Multiple Tabs Saved in Notepad++?:

    @Troglo37 said in How Do I Keep Multiple Tabs Saved in Notepad++?:

    so I decided to break them up into categories by using the tabs for each category to make them easier to navigate through.
    So now you know why my understanding and knowledge of how N++ works is very limited.

    … and now you know that each tab is a different file. And if you want to properly save that file, you have to give it a name and make sure you know where it’s saving each file (so that you can find those files again later, or using a different application some day in the future)

    I just checked and they’re all saved as individual files. Oh BTW, periodically I copy my N++ to an external drive as a backup in case my PC crashes.