• Something like "negative" search?

    4
    0 Votes
    4 Posts
    1k Views
    H

    @ekopalypse said in Something like "negative" search?:

    ^(?!.this_is_not_included).

    Thx for your reply. Unfortunatly that seems not to work. I will look into the thread you mentioned.

  • Regex: Show the string result from searching ALL FILES, between 2 parts

    12
    0 Votes
    12 Posts
    464 Views
    Alan KilbornA

    @neil-schipper said in Regex: Show the string result from searching ALL FILES, between 2 parts:

    copy text from Search Results (pane or window) into this new file.

    There are 2 ways to do this, depending on whether or not you need information about the files to carry over in the copy.

    This method will get you the search/file/line info along with the lines-of-match:

    2d688ece-d6dd-48c3-81ef-eb905e23b8f0-image.png

    will get:

    Search "t" (2 hits in 1 file of 1 searched) new 1 (2 hits) Line 1: (?s)(?!.*this_is_not_included).* Line 1: (?s)(?!.*this_is_not_included).*

    This method will get you only the line data of the match:

    bbd8a609-ea09-4faf-b9d4-ce4d9a871158-image.png

    will get:

    (?s)(?!.*this_is_not_included).*

    Note that in the second example, since there are 2 results but the matched lines are the same line, only ONE copy of the line data is put into the clipboard.

  • Pythonscript hidelines()

    14
    0 Votes
    14 Posts
    701 Views
    Paul WormerP

    @alan-kilborn
    I thank you and the others in this thread for their patient advice. To show what I did with it, I copy my script and sample input.

    """ Hide entries in a diary. - Daily entries are preceded by an empty line followed by the date on a single line. - Dates can be either in American or in European format. - Days occur with irregular intervals. """ from __future__ import print_function # Python 2.7 from Npp import * def getStartPositionNextLine(pos): """ Get start position of line below line of `pos`. Note that positions in scripts start at 0 whereas the statusline gives a position starting at 1. """ rpos = editor.getLineEndPosition(editor.lineFromPosition(pos)) + 2 #skip \r\n return rpos def getEndPositionPreviousLine(pos): rpos = editor.getLineEndPosition(editor.lineFromPosition(pos)-1) return rpos regex = r'^\d{1,2}(-|/)\d{1,2}(-|/)\d{4}?' # European or American date lenFile = editor.getLength() # Find start and end position of first date string: startDate, endDate = editor.findText(FINDOPTION.REGEXP, 0, lenFile, regex) startSel = getStartPositionNextLine(endDate) editor.setSelectionStart(startSel) while endDate < lenFile: startDate0, endDate0 = startDate, endDate try: startDate, endDate = editor.findText(FINDOPTION.REGEXP, endDate0, lenFile, regex) except: break else: # Go back 2 lines skipping empty line: endSel = getEndPositionPreviousLine(getEndPositionPreviousLine(endDate)) editor.setSelectionEnd(endSel) notepad.menuCommand(MENUCOMMAND.VIEW_HIDELINES) # New selection starts at line below date line: startSel = getStartPositionNextLine(endDate) editor.setSelectionStart(startSel) editor.setSelectionEnd(lenFile) notepad.menuCommand(MENUCOMMAND.VIEW_HIDELINES)

    A sample diary:

    DE BELLO GALLICO 3-1-2019 Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae, aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur. Hi omnes lingua, institutis, legibus inter se differunt. Gallos ab Aquitanis Garumna flumen, a Belgis Matrona et Sequana dividit. Horum omnium fortissimi sunt Belgae, propterea quod a cultu atque humanitate provinciae longissime absunt, minimeque ad eos mercatores saepe commeant atque ea quae ad effeminandos animos pertinent important, proximique sunt Germanis, qui trans Rhenum incolunt, quibuscum continenter ellum gerunt. 7/6/2019 Qua de causa Helvetii quoque reliquos Gallos virtute praecedunt, quod fere cotidianis proeliis cum Germanis contendunt, cum aut suis finibus eos prohibent aut ipsi in eorum finibus bellum gerunt. Eorum una pars, quam Gallos obtinere dictum est, initium capit a flumine Rhodano, continetur Garumna flumine, Oceano, finibus Belgarum, attingit etiam ab Sequanis et Helvetiis flumen Rhenum, vergit ad septentriones. Belgae ab extremis Galliae finibus oriuntur, pertinent ad inferiorem partem fluminis Rheni, spectant in septentrionem et orientem solem. Aquitania a Garumna flumine ad Pyrenaeos montes et eam partem Oceani quae est ad ispaniam pertinet; spectat inter occasum solis et septentriones. 10/9/2019 (ibidem) Apud Helvetios longe nobilissimus fuit et ditissimus Orgetorix. Is M. Messala, M. Pisone consulibus regni cupiditate inductus coniurationem nobilitatis fecit et civitati persuasit ut de finibus suis cum omnibus copiis exirent: perfacile esse, cum virtute omnibus praestarent, totius Galliae imperio potiri. Id hoc facilius iis persuasit, quod undique loci natura Helvetii continentur : una ex parte flumine Rheno latissimo atque altissimo, qui agrum elvetium a Germanis dividit; altera ex parte monte Iura altissimo, qui est inter Sequanos et Helvetios; tertia lacu Lemanno et flumine odano, qui provinciam nostram ab Helvetiis dividit. 22-12-2019 His rebus fiebat ut et minus late vagarentur et minus facile finitimis bellum inferre possent; qua ex parte homines bellandi cupidi agno dolore adficiebantur. Pro multitudine autem hominum et progloria belli atque fortitudinis angustos se fines habere arbitrabantur, qui in longitudinem milia passuum CCXL, in latitudinem CLXXX patebant.
  • multiple search and remove

    14
    0 Votes
    14 Posts
    5k Views
    guy038G

    Hello, @handa-flocka, @peterjones, @alan-kilborn and All,

    Just tried your script, Peter and it wokrs like a charm ! Of course, the list of strings can be displayed in any order !

    Now, regarding your attempt to find a previous script, on this topic, maybe it could be related to this @ekopalypse’s script :

    https://community.notepad-plus-plus.org/post/57173

    and the @alan-kilborn’s subsequent modification :

    https://community.notepad-plus-plus.org/post/57229

    Changes are, of course, needed to fit this present topic !

    BR

    guy038

  • Format data for CSV

    2
    0 Votes
    2 Posts
    637 Views
    Michael VincentM

    @marissa-stradley

    Record a macro.

    Put cursor before the “39” Macro => Start Recording Press the Shift key and press the down arrow 10 times (so that you’ve highlighted the lines from “39” to the blank line before “40”) Edit => Line Operations => Join Lines Press the down arrow and Home key so the cursor is now in front of the “40”. Macro => Stop Recording

    Now use the Macro => Run a Macro Multiple Times… menu entry to finish the file.

    Cheers.

  • Weird regex mode searching in normal search mode

    7
    2 Votes
    7 Posts
    358 Views
    EkopalypseE

    @alan-kilborn

    the SCI_SETSEARCHFLAGS might be the culprit.
    But I haven’t done any tests, I must say.

  • Counting up a number that is part of a line

    5
    0 Votes
    5 Posts
    475 Views
    Cirlot123456C

    @ekopalypse thanks I worked it out now, this is gonna be immensely useful in the future :)

  • Does N++ have Auto-Scrolling?

    3
    0 Votes
    3 Posts
    1k Views
    artie-finkelsteinA

    @luis-piña-iii

    The MMB is not a scroll button, but can be made into one with XMBC. Please note this application is outside the subject purview of this community and any support must come from the XMBC community (there is one).

  • Search - Retained ? ? ?

    8
    0 Votes
    8 Posts
    630 Views
    artie-finkelsteinA

    @kendall-demott

    Based on my current workflow, I will create a “phrase file” to store boiler plate or frequently needed text for a project. I drag the tab to the far left and leave that file loaded as I merrily edit other files. The far left tab is easy to jump to using the Window menu selection. Then it’s just a case of jump to tab, copy text, jump back to context (current) tab and execute the search and paste the copied test into the search menu. Admittedly, returning to the context (current) tab is not always easy if I have many files open. By using session files (or just relying on the built in session manager), the phrase file becomes part of the project. This approach may be a bit crude, but I can easily modify it as the tasks change.

    There are plugins that also handle things like this (quips, boiler plate, etc.), I just haven’t found one I liked enough to really learn how to use it and change my eclectic workflows appropriately.

  • How create UDL by defined/default langunge(PHP)?

    5
    0 Votes
    5 Posts
    517 Views
    WinterSilenceW

    @ekopalypse hm… as I see, PHP and JS have common code to folding blocks, but array folding doesn’t work in PHP files.

  • Automatically scrolling to caret

    6
    0 Votes
    6 Posts
    472 Views
    Alan KilbornA

    Actually, this seems to do it:

    editor.setFirstVisibleLine(editor.visibleFromDocLine(editor.lineFromPosition(editor.getCurrentPos())))

  • Run a Java program

    4
    0 Votes
    4 Posts
    2k Views
    dominikcebulaD

    Hello, recently I have created “Java Plugin for Notepad++” that allows you to compile and run java in Notepad++.
    You can find more information here https://github.com/dominikcebula/npp-java-plugin

  • Stuck in [Administrator] mode - My solution

    1
    1 Votes
    1 Posts
    241 Views
    No one has replied
  • 0 Votes
    5 Posts
    2k Views
    Alan KilbornA

    @robert-carnegie said in Treat ANSI text file as UTF-8 while use utf-8-bom as default saving format:

    I may be misspeaking

    Yep.

    but I think you should be saying “ASCII” not “ANSI”

    Nope.

  • Save as .txt when no extension typed

    3
    0 Votes
    3 Posts
    398 Views
    Alan KilbornA

    @artie-finkelstein

    I notice that if Append extension is ticked when the dialog box is invoked, unticking it will not remove the .txt extension from new 1.txt in the File name box. Thus, it must be removed manually – not a big deal IMO, because the new1 part is going to need to be altered anyway – before hitting Save. But some users may complain that this is a big annoyance.

    The Append extension checkbox has a “memory” so the next save of this type will be invoked with the checkbox unticked and only new 2 (for example) will appear in the File name box.

  • How can I search a specific numbers in between two numbers?

    5
    0 Votes
    5 Posts
    2k Views
    Alan KilbornA

    @rab_road said in How can I search a specific numbers in between two numbers?:

    …between 1000 and 1500

    inclusion of the endpoints is implied? :-)

    (?<!\d)(?:(?:1[0-4]\d\d)|(?:1500))(?!\d)

  • How to delete multiple words/part of lines in log

    4
    0 Votes
    4 Posts
    261 Views
    Marko DmitrovićM

    Done it!
    It’s going with: \ (.*

    Thanks! :)

  • Creating a tally count of line duplicates

    3
    0 Votes
    3 Posts
    1k Views
    a-raccoonA

    Thanks for the find @terry-r, I’ll find that PythonScript plugin and play with it.

    I assume I should be able to change the regex pattern to suit my needs in the line editor.research('\w+', match_found) to something like editor.research('^.*$', match_found) to perform a histogram by line.

    Much appreciated.

  • Why is there no showing function for member access in Notepad++?

    3
    0 Votes
    3 Posts
    268 Views
    Lycan ThropeL

    @youngsun-jang ,

    Also it also sounds like you’re interested in the Auto Completion capability, but again, if not a standard langauge, you’ll have to develop it yourself. Find more informatiton, here: Auto Completion Info:

    Good luck, and welcome to Notepad++.

    Lee

  • HTML - Only save the heading and paragraphs text, remove images and links

    4
    0 Votes
    4 Posts
    576 Views
    astrosofistaA

    @daniel-norin, @guy038, all

    Just for the sake of variety, here is my take. It seems to work fine on input data, hope it can deal with other inputs.

    Note that it does not remove empty paragraphs, such as the first and sixth. Anyway, it is easy to delete them in a second step.

    Instructions are similar to the ones provided by @guy038. Open the Replace dialog (Ctrl + H) and type:

    Search: (?s)<(?!/?p>|/?h3>?).*?>| id=.*?(?=>) Replace: [leave empty]

    Put the caret at the very beginning of the document, select the Regular Expression mode and click on Replace or Replace All.

    Output:

    <p></p> <p>Earlier this month we unveiled the nominees for the Ninth Annual Sprudgie Awards. Voting is now open across a dozen categories, honoring the very best in coffee. Voting ends December 31st, 2017 at 11:59 PM.</p> <p>In this feature, we’re spotlighting the 2017 nominees for Best Coffee Film/Video, one of the tightest races in all Sprudgie Award categories. Past winners for Best Coffee Film/Video include the Gilmore Girls: A Year In The Life, Barista, Dunkin Love, Hey Girl Guide To Coffeeing, Comedians in Cars Getting Coffee, and “Kenya” (Stumptown Coffee Roasters).</p> <p>Let’s meet this year’s nominees!</p> <h3>The Young and the Spoonless by Cafe Imports</h3> <p></p> <h3>I Yelp By The Way by Dapper & Wise</h3>

    Stay healthy