• Hi Users i need to search some word betwen words

    2
    0 Votes
    2 Posts
    258 Views
    Terry RT

    @jan-kobiela said in Hi Users i need to search some word betwen words:

    I need to search some phrases between words or numbers for example:

    Your examples don’t really fit your explanation, however I will attempt to provide some information and also ask further questions.

    When you say you want to search for “phrases” this generally means strings of characters delimited by a space, these can also be called sentences of portions of them. Yet your example has only numbers which doesn’t really help.

    As it would seem that you want every second word/string of characters it implies the space character MUST be the delimiter. If so then the following would suffice. As this initial solution is destructive you would need to work on a copy of your file, not the original.

    Use the “Replace” function and as this is a regular expression you will need to have the search mode set to “regular expression”.
    Find What:[^\x20\r\n]+\x20([^\x20+\r\n]+)
    Replace With:\1
    Then click on the “Replace All” button. Every second word will remain.

    As I said, this is likely only an initial answer. If you were to read the `Please Read This Before Posting" at the top of this group you will then know how to properly provide examples, and you should provide better examples as currently your example and question are too vague to be sure that my answer will actually help.

    Terry

  • Plugin ACCPC instalation problem

    3
    0 Votes
    3 Posts
    4k Views
    Salim houssiniS

    @standog same problem, it’s the same dll version in notepad ++

  • How to open Notepad++ with a new empty file?

    4
    0 Votes
    4 Posts
    6k Views
    Robert CarnegieR

    Referring to https://npp-user-manual.org/docs/command-prompt/

    another approach is to start Notepad++ with the “command line” parameter of: -nosession

    For instance, a Windows 10 desktop icon (shortcut) for Notepad++ can be copied and/or can have its “target of shortcut” changed to:

    “C:\Program Files\Notepad++\notepad++.exe” -nosession

    This is for the 64-bit version.

    This customized icon starts Notepad++ without opening the auto saved session. Only an empty “new 1” tab appears.

    It appears also that this Notepad++ instance does not create a saved session for the default Notepad++ configuration to reload later, and does not remove the saved session that the default configuration remembers. (I am only trying it with one file to be remembered open when I close Notepad++.)

    Another “command line” or shortcut option to consider is “-multiInst”. This opens a window for Notepad++ even when Notepad++ is running already. Trying it now, the second window will contain the saved session tabs evidently, unless -nosession -multiInst are used together.

    Up to now, I’ve just been closing my tabs (Ctrl+w) before closing Notepad++ and especially if I’ve had a very large text data file open: these are other good options.

  • How to delete autosaved "unnamed" `new 1` files?

    3
    1 Votes
    3 Posts
    278 Views
    Peter PeterP

    @alan-kilborn

    Exactly, great! Thank you!

  • someone help me with this

    3
    0 Votes
    3 Posts
    793 Views
    Alan KilbornA

    Looking through your previous postings, that’s about the end of the “freebies” you’re getting. Time to start doing some learning, so that you can solve your own problems! See HERE for a good starting point!

  • Can't open .txt files - "Session file is either corrupted or not valid"

    15
    0 Votes
    15 Posts
    7k Views
    Jonathan NichJ

    DR Smockovich is correct.

    The problem only occurred when I changed the setting in:

    Notepadd++ > Settings > MISC > Session file extension, and Workspace file extension

    They were blank. I changed them to “.php” thinking it would then save files in .php extension rather than me having to type out the extension every time I saved a file.

    That is not so.

    I removed and cleared those two settings to make them blank again and viola, the probelm of the original poster went away (session corrupted etc).

    If you’re attempting to get notepad to save in a particular file extension every time you save a file by default, then click on:

    Save As… > Append Extension (little tick box by the “save” button).

    Have a good day :)

  • create a diary calendar for 2022

    4
    0 Votes
    4 Posts
    2k Views
    Alan KilbornA

    @astrosofista

    Off-topic. Downvoting.
    Responding to off-topic posts only encourages more people to use this forum as a free for all to ask any question they like, adding to the clutter for those of us interested in only Notepad++ topics here.
    Please don’t claim it is “on topic” because it generates data that can be pasted into a Notepad++ tab.
    Surely if you are good at AutoHotKey you can go over to their forum and write as many scripts for people as you like.

  • Ayuda txt

    4
    0 Votes
    4 Posts
    931 Views
    PeterJonesP

    @nippurdelagash ,

    Please write in English to this forum. This is the second time you have been asked.

    Notepad++ keeps track of the most recent files edited in Notepad++, either in the File menu or in the File > Recent Files… submenu, depending on the Settings > Preferences > Recent Files History settings (as documented in the user manual).

    If you don’t know where you keep your own files, then you can use a Windows OS-based search for filename across your whole filesystem, or you can use Notepad++'s built-in Search > Find in Files dialog to look for particular text in files that have a particular extension. And, in the future, I would recommend organizing your filesystem in a manner that allows you to know where your own files are – because where on the disk that you store your files is, in the end, up to you.

  • Lost unsaved windows after upgrade

    6
    0 Votes
    6 Posts
    3k Views
    guy038G

    Hi, @HappySave,

    Your name is quite humorous, considering your initial situation, where you did not know if a solution was possible !!

    Best Regards,

    guy038

  • Practical to remove "white" areas between marked data on adjacent lines?

    7
    0 Votes
    7 Posts
    440 Views
    Alan KilbornA

    @dail nailed it, and @Nick-Brown was very close (but slightly incomplete). Thanks, both of you.

    If I do this in PythonScript:

    editor.indicSetStyle(31, 16) editor.indicSetOutlineAlpha(31, editor.indicGetAlpha(31))

    Then I get the effect I’m after:

    0504a455-746f-48eb-9a80-00d66b6661ae-image.png

    Note that 31 is the indicator number for red-marking, and 16 is the value for INDIC_FULLBOX.

  • Notepad getting hanged when I fold my file

    6
    0 Votes
    6 Posts
    491 Views
    PeterJonesP

    @arpan-kumar ,

    Well, if you don’t need spell check turned on while editing XML files, you can go to Plugins > DSpellCheck > Settings, and change the “File Types” section to “Check only NOT those:” and *.xml as the text entry, as shown in my screenshot:

    8d61bf2e-5c7a-4ff2-b4f8-32c3b6ed6214-image.png

    When I do that (and APPLY or OK), it stops spell checking the XML files. I don’t know if that will be sufficient for you. (I created a 2MB XML file, and even with DSpellCheck doing spell check and finding misspelled words, I couldn’t get it to hang when folding/unfolding the various levels. So I cannot replicate your problem to know whether turning off spell checker for XML is sufficient.)

  • UDL - using keywords with spaces

    2
    0 Votes
    2 Posts
    725 Views
    PeterJonesP

    @pierre-de-la-verre

    Can you give me an example?

    677c53b9-78b9-437a-9963-5ada0efd83d4-image.png

  • how to check if 160th character of every line is 'Z' ?

    8
    0 Votes
    8 Posts
    2k Views
    Alan KilbornA

    Additional helpful information for combining search criteria is found HERE.

  • What is BUFFERENCODING.COOKIE ??

    10
    0 Votes
    10 Posts
    1k Views
    Alan KilbornA

    @alan-kilborn said in What is BUFFERENCODING.COOKIE ??:

    How is one to tell the difference, in Pythonscript, if the current file’s encoding is UTF-8 without BOM, or for example, ISO-8859-1 ?

    @peterjones said in What is BUFFERENCODING.COOKIE ??:

    I thought there would be a way to read back the character set, distinct from the GETBUFFERENCODING message… but I cannot find a message that does that. Barring that, I thought that the scintilla object might have that info somewhere, but I cannot find it there, either. …maybe @Ekopalypse has insight on this one.

    @ekopalypse said in What is BUFFERENCODING.COOKIE ??:

    Sorry, but I have no idea.

    So…it’s a bit cheesy, but one can read the status bar field that shows the encoding type to get this information (as its text string).

    We’ve discussed in this forum how to get the status bar data before using a PythonScript, but I’ve revamped my code for doing it so I’ll post the whole thing here.

    Here’s NotepadGetStatusBar.py with a demo at the end to show the current file’s encoding:

    # -*- coding: utf-8 -*- from __future__ import print_function from Npp import * import ctypes from ctypes.wintypes import BOOL, HWND, WPARAM, LPARAM, UINT class NGSB(object): # implements a "getStatusBar" function (complement to notepad.setStatusBar()) def __init__(self): self.SendMessageW = ctypes.windll.user32.SendMessageW LRESULT = LPARAM self.SendMessageW.restype = LRESULT self.SendMessageW.argtypes = [ HWND, UINT, WPARAM, LPARAM ] self.create_unicode_buffer = ctypes.create_unicode_buffer self.curr_class_256 = self.create_unicode_buffer(256) self.STATUSBAR_HANDLE = None self._determine_statusbar_handle() assert self.STATUSBAR_HANDLE def get_statusbar_by_section(self, statusbar_item_number): # statusbar_item_number can be integer 0 thru 5 or one of: # STATUSBARSECTION.DOCTYPE # STATUSBARSECTION.DOCSIZE # STATUSBARSECTION.CURPOS # STATUSBARSECTION.EOFFORMAT # STATUSBARSECTION.UNICODETYPE # STATUSBARSECTION.TYPINGMODE return self._get_statusbar_section(statusbar_item_number) def get_statusbar_as_tuple(self): section_list = [ STATUSBARSECTION.DOCTYPE, STATUSBARSECTION.DOCSIZE, STATUSBARSECTION.CURPOS, STATUSBARSECTION.EOFFORMAT, STATUSBARSECTION.UNICODETYPE, STATUSBARSECTION.TYPINGMODE, ] return tuple(list(map(lambda x: self._get_statusbar_section(x), section_list))) def _determine_statusbar_handle(self): WNDENUMPROC = ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM) FindWindowW = ctypes.windll.user32.FindWindowW FindWindowExW = ctypes.windll.user32.FindWindowExW EnumChildWindows = ctypes.windll.user32.EnumChildWindows GetClassNameW = ctypes.windll.user32.GetClassNameW self.STATUSBAR_HANDLE = None def enum_callback_fn(hwnd, lparam): GetClassNameW(hwnd, self.curr_class_256, 256) if self.curr_class_256.value.lower() == "msctls_statusbar32": self.STATUSBAR_HANDLE = hwnd return False # stop the enumeration return True # continue the enumeration npp_hwnd = FindWindowW(u"Notepad++", None) #print('npp_hwnd:', npp_hwnd) EnumChildWindows(npp_hwnd, WNDENUMPROC(enum_callback_fn), 0) #print('self.STATUSBAR_HANDLE:', self.STATUSBAR_HANDLE) def _get_statusbar_section(self, statusbar_item_number): assert statusbar_item_number <= 5 WM_USER = 0x400 SB_GETTEXTLENGTHW = WM_USER + 12 SB_GETTEXTW = WM_USER + 13 SBT_OWNERDRAW = 0x1000 retcode = self.SendMessageW(self.STATUSBAR_HANDLE, SB_GETTEXTLENGTHW, statusbar_item_number, 0) length = retcode & 0xFFFF type = (retcode >> 16) & 0xFFFF assert (type != SBT_OWNERDRAW) text_buffer = self.create_unicode_buffer(length) retcode = self.SendMessageW(self.STATUSBAR_HANDLE, SB_GETTEXTW, statusbar_item_number, ctypes.addressof(text_buffer)) retval = '{}'.format(text_buffer[:length]) return retval if __name__ == '__main__': print(NGSB().get_statusbar_by_section(STATUSBARSECTION.UNICODETYPE))

    Running the script will print the current file’s encoding (from statusbar information) to the Pythonscript console window.

  • Search, Use Result to Add Code

    10
    0 Votes
    10 Posts
    582 Views
    Alan KilbornA

    @richard-howard said in Search, Use Result to Add Code:

    So, after your ‘encouraging me’ to do a little research before just asking for the answer, I found something that works.

    Awesome. You can only get better by taking such initiative.

  • Printing Contrast Is Too Light!

    7
    0 Votes
    7 Posts
    4k Views
    Simon KravisS

    @simon-kravis These settings fixed the problem
    3371f9d6-3fbb-46d5-b1d7-897a9d53133a-image.png

  • [CRITAL-HELP] File Content Lost When Save

    14
    0 Votes
    14 Posts
    2k Views
    Jaci ColvinJ

    @terry-r Thanks Terry. It is already ticked. I don’t know why it wasn’t notifying me of updates and I never deliberately disabled it. Not sure why that happened. Just now that I think about it, it used to asked for updates, but not in some time. I’ve manually done it now anyway.

    Will need to go and rewrite a second file it’s wiped on me now :(

  • replacement

    3
    0 Votes
    3 Posts
    244 Views
    Си ДжейС

    @alan-kilborn said in replacement:

    ${1}3000

    thank you

  • regex replace performance regression

    15
    2 Votes
    15 Posts
    1k Views
    guy038G

    Hi, @cmeriaux, @peterjones, @alan-kilborn, @arkadiuszmichalski and All,

    So, I"m going on testing some examples of text, dealing with replacements, bookmarks and replacement modifiers ! Note that I did not consider the Admin case, rather identical !

    First, I used the @sasumner’s file data8279.txt ( 300,000 lines ) and I performed two types of text :

    A global replacement of (?-s)^.*NotepadPP.*\R with Nothing, with the Wrap around option ticked ( First table, below )

    A mark operation of the string NotepadPP, with the Bookmark line and Wrap around option ticked, but not the Match case one, followed with a Search > Bookmark > Remove Bookmarked Lines operation ( Second table, below )

    203,236 occurrences were deleted or were marked then deleted !

    •===============•=============•==========•=================• | Archi- | Version | User Mode | | | |----------•-----------------| | tecture | Notepad++ | Time | Ratio x32/x64 | •===============•=============•==========•=================• | Win XP x32 | 7.9.2 | 65.0 s | -/- | •===============•=============•==========•=================• | Win 10 x32 | 7.9.2 | 47.6 s | | •---------------•-------------•----------• 1.27 | | Win 10 x64 | 7.9.2 | 37.5 s | | •===============•=============•==========•=================• | Win 10 x32 | 7.9.5 | 47.4 s | | •---------------•-------------•----------• 1.27 | | Win 10 x64 | 7.9.5 | 37.4 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.0 | 86.2 s | | •---------------•-------------•----------• 1.22 | | Win 10 x64 | 8.0 | 70.4 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.1.5 | 47.6 s | | •---------------•-------------•----------• 1.27 | | Win 10 x64 | 8.1.5 | 37.5 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.1.9.2 | 47.5 s | | •---------------•-------------•----------• 1.28 | | Win 10 x64 | 8.1.9.2 | 37.2 s | | •===============•=============•==========•=================• •===============•=============•====================================• | Archi- | Version | User Mode | | | |------------------•-----------------| | tecture | Notepad++ | Time | Ratio x32/x64 | •===============•=============•==================•=================• | Win XP x32 | 7.9.2 | 10.0 s + 64.2 s | -/- | •===============•=============•==================•=================• | Win 10 x32 | 7.9.2 | 4.9 s + 49.1 s | | •---------------•-------------•------------------• 1.36 | | Win 10 x64 | 7.9.2 | 2.1 s + 37.5 s | | •===============•=============•==================•=================• | Win 10 x32 | 7.9.5 | 4.8 s + 49.1 s | | •---------------•-------------•------------------• 1.35 | | Win 10 x64 | 7.9.5 | 2.3 s + 37.6 s | | •===============•=============•==================•=================• | Win 10 x32 | 8.0 | 20.0 s + 49.1 s | | •---------------•-------------•------------------• 1.31 | | Win 10 x64 | 8.0 | 14.8 s + 37.8 s | | •===============•=============•==================•=================• | Win 10 x32 | 8.1.5 | 4.8 s + 49.3 s | | •---------------•-------------•------------------• 1.35 | | Win 10 x64 | 8.1.5 | 2.3 s + 37.7 s | | •===============•=============•==================•=================• | Win 10 x32 | 8.1.9.2 | 4.8 s + 49.2 s | | •---------------•-------------•------------------• 1.37 | | Win 10 x64 | 8.1.9.2 | 2.1 s + 37.4 s | | •===============•=============•==================•=================•

    In the second table, I decomposed the total time in two parts :

    Time to bookmark the lines

    Time to delete these lines

    I summarized the two values before calculating the ratio x32/x64

    Interpretation of the results :

    If xe except the special case of the v8.0 version, the results are very similar, for the two tables :

    In the first case, the more complicated regex (?-s)^.*NotepadPP.*\R decrease a bit the ratio between the x32 and x64 versions

    In the second case, both the mark operation and the deletion of lines have an impact, but the ratio between the x32 and x64 versions is a bit better

    Note that, regarding the v8.0 version, in the second table, the performance regression comes from the bad results of the mark operation only !

    I performed a last test, using the same Search and Replace regexes than in my initial issue :

    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9636

    So the regex S/R :

    SEARCH \w

    REPLACE \U$0

    I, then, created a file containing 1,000 lines ( every odd ones ) with the French text :

    C’est là, près de la forêt, dans un gîte, où régnait un grand capharnaüm, que l’aïeul ôta sa flûte et son bâton de son canoë.

    And I added 1,000 English lines ( every even ones ) :

    Here is a example of text, containing the complete French set of accentuated characters, traditionally used.

    After replacement, 184,000 occurrences have been modified :

    •===============•=============•==========•=================• | Archi- | Version | User Mode | | | |----------•-----------------| | tecture | Notepad++ | Time | Ratio x32/x64 | •===============•=============•==========•=================• | Win XP x32 | 7.9.2 | 18.7 s | -/- | •===============•=============•==========•=================• | Win 10 x32 | 7.9.2 | 10.5 s | | •---------------•-------------•----------• 2.56 | | Win 10 x64 | 7.9.2 | 4.1 s | | •===============•=============•==========•=================• | Win 10 x32 | 7.9.5 | 10.3 s | | •---------------•-------------•----------• 2.51 | | Win 10 x64 | 7.9.5 | 4.1 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.0 | 38.5 s | | •---------------•-------------•----------• 1.41 | | Win 10 x64 | 8.0 | 27.4 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.1.5 | 10.4 s | | •---------------•-------------•----------• 2.54 | | Win 10 x64 | 8.1.5 | 4.1 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.1.9.2 | 10.4 s | | •---------------•-------------•----------• 2.54 | | Win 10 x64 | 8.1.9.2 | 4.1 s | | •===============•=============•==========•=================•

    Interpretation of the results :

    Again, if we except the special case of the v8.0 version :

    The results, whatever the version, are quite similar, for each case ( x32 and x64 )

    The ratio x32/x64 is similar to the one of my previous post ( ~ 2.52 ) !

    Best Regards,

    guy038

  • Regex Search With Quotations

    7
    0 Votes
    7 Posts
    4k Views
    DevSrc8D

    @peterjones thanks for all your help!

    is there a marked as Solved for this forum?