• translate \r\n

    3
    0 Votes
    3 Posts
    2k Views
    Stuart HerringS

    Thanx!
    I’m not yet trained in the use of RegExes, but I can get there…

  • Search yields irrelevant results. I'm stuck :)

    7
    0 Votes
    7 Posts
    983 Views
    Alan KilbornA

    I’m kind of unclear on this thread…

    But I wanted to ask: Does Notepad++ really make a Find Next search result unclear in this situation? I’d think that the selection marking it uses for this would always be clear, above and beyond any other type of highlighting that is going on. Not so?

  • 0 Votes
    9 Posts
    2k Views
    Alan KilbornA

    @guy038 said in Regex: Select and delete the content of tags from xml file with skiping other tags:

    Now, as always, everything is in the fucking manual ! So, first, go to the official N++ documentation

    Whoa, whoa, WHOA!
    Could it be that the ever-patient @guy038 is getting tired of all the repetitive regex stuff here?? Say it isn’t so.
    I get tired of it as well…so tired…but I haven’t yet been driven to use the alternate definition of RTFM (the normal definition being Read That Fine Manual).

    Seriously, though, when I look at that section of the manual, it reads more like formula rather than specific application (and that’s ok).

    In the manual we have:

    (?enable-disable)

    which, well, isn’t exactly crystal clear for those that don’t already know what it means.

    So my attempt, in explaining the (?.. : …) construct was to help clarify.
    I don’t know if I succeeded.

  • Zero character indents?

    7
    0 Votes
    7 Posts
    504 Views
    TBugReporterT

    Actually, I usually just keep the ¶ button on, but this time I turned it off because all the [CR][LF]s were becoming distracting. (And yes, I know it’s possible to show whitespace without the [CR][LF]s, but I didn’t feel like digging into the menus for what I thought was going to be a quick edit.)

  • Resizing Notepad++ resizes all documents and shows articafacts

    5
    0 Votes
    5 Posts
    694 Views
    Greg ShulerG

    Debug Info

    Notepad++ v8.1 (64-bit) Build time : Jun 17 2021 - 01:56:07 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : Admin mode : OFF Local Conf mode : OFF Cloud Config : OFF OS Name : Windows 10 Enterprise (64-bit) OS Version : 1909 OS Build : 18363.1621 Current ANSI codepage : 1252 Plugins : DSpellCheck.dll JSMinNPP.dll mimeTools.dll NppConverter.dll NppExport.dll _CustomizeToolbar.dll

    Monitor setup
    Laptop w/2k display driving a 43" 4K TV as main monitor over HDMI, occassionally running Display Fusion Pro.

    Windows

    OS Name Microsoft Windows 10 Enterprise Version 10.0.18363 Build 18363 Other OS Description Not Available OS Manufacturer Microsoft Corporation System Name SR90NRZH7 System Manufacturer LENOVO System Model 20JF000DUS System Type x64-based PC
  • DSpellCheck plugin does not work for json files

    3
    0 Votes
    3 Posts
    617 Views
    artie-finkelsteinA

    Another alternative is to use the Windows ‘mklink’ command line utility and create a hardlink to the file, assuming an NTFS formatted disk. Mklink will complain if the target disk is not using the NTFS format.

    > mklink /h file.json.txt file.json

    There will only be one file using storage space on the disk, but two ways of accessing the contents (be careful if both are opened at the same time; Notepad++ will gladly have both views open at the same time and may warn about changes made using the the other view).

    I use the ‘added’ .txt extension to assist the OS in keeping both views together when using name listings, e.g. “dir”. The Explorer preview pane will show the contents as text (even if the original file isn’t text, e.g., .pdf or .jpg). The extra extension also assists me in remembering which is the real or base file and which is the alternate view I created to get around Windows obsession with extension based file format determination.

    The file will persist (continue to use disk space) until both names are deleted, either from the command line or in Explorer.

    Not all disk space applications understand ‘hardlinks’ and will incorrectly show both files using disk space.

  • Auto opening backup is not working

    4
    0 Votes
    4 Posts
    214 Views
    Игорь НовиковИ

    Issue happens after windows is getting updates only. If I close/open N++ OR restart Windows without getting updates then all sessions are getting opened.

  • Search for a text and copy the next lines of codes

    5
    2 Votes
    5 Posts
    373 Views
    Kev AlejandrinoK

    @Alan-Kilborn said in Search for a text and copy the next lines of codes:

    (?-s)SEARCHME(?:.\R){3}\K.

    Thank you! It works just what I wanted.

  • Find regex file name

    3
    0 Votes
    3 Posts
    816 Views
    David ArdaizD

    I need to search for file names in html code.

    Text to search D: \ Fitos \ excel \ ([1-9] [0-9] *) (. Xlsx “target =” _ top "> Old pdf)
    Replace with D: \ Fitos \ excel2 \ $ 2 (.xlsx “target =” _ top "> Old Pdf) with this regex search I find Excel files like 13037.xlsx

  • RegEx omitting the round brackets

    6
    0 Votes
    6 Posts
    1k Views
    Scott NielsonS

    @PeterJones yea, it worked. I had a </p> in my next search - that’s why it di’n’t work before. Thanks a lot man!

  • Macro changes my (macro) definition

    4
    0 Votes
    4 Posts
    423 Views
    Alan KilbornA

    If I try recording a macro for what I think you are trying to do (but from your description it is not 100% clear to me what this is), I get the following, and it always works for me:

    <Macro name="xxx" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="&#x00A0;" /> <Action type="3" message="1625" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="&amp;nbsp;" /> <Action type="3" message="1702" wParam="0" lParam="512" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> </Macro>
  • 0 Votes
    5 Posts
    225 Views
    Robin CruiseR

    super answer @guy038 thanks.

    I made a short version of yours:

    <title>\K(?![^\x00-\x7F]+).*?\| - finds the first line

    <title>\K([^\x00-\x7F]+).*?\| - finds the second line

  • Markdown in dark mode looks wrong

    4
    0 Votes
    4 Posts
    3k Views
    mere-humanM

    Don’t confuse dark mode with “dark” theme.
    Dark mode is only about the UI elements (everything except the document area).
    Dark theme is about the document area.

    This is a known problem, it is related to the dark theme.
    There are numerous issues about this:
    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6140
    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9649

  • Finding and deleting a series of lines

    15
    0 Votes
    15 Posts
    5k Views
    Alan KilbornA

    @guy038

    Actually, what you’ve specified is for finding some… , not deleting some…

    To delete, we need to specify:

    SEARCH (as above) REPLACE leave this field blank

    :-)

  • file:///folder opens CMD instead of explorer

    8
    0 Votes
    8 Posts
    660 Views
    tho-gruT

    Hello everyone,

    One solution to my problem is to replace all occurrences of open with command-exec in the registry file:

    Windows Registry Editor Version 5.00 ; Command Prompt [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\XxX-01MenuCmd] "MUIVerb"="@shell32.dll,-22022" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="Directory\\ContextMenus\\XxX-MenuCmd" [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\background\shell\XxX-01MenuCmd] "MUIVerb"="@shell32.dll,-22022" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="Directory\\ContextMenus\\XxX-MenuCmd" [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\ContextMenus\XxX-MenuCmd\shell\command-exec] "MUIVerb"="@shell32.dll,-8506" "Icon"="cmd.exe" [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\ContextMenus\XxX-MenuCmd\shell\command-exec\command] @="cmd.exe /s /k pushd \"%V\"" [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\ContextMenus\XxX-MenuCmd\shell\runas] "MUIVerb"="@shell32.dll,-37444" "Icon"="cmd.exe" "HasLUAShield"="" [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\ContextMenus\XxX-MenuCmd\shell\runas\command] @="cmd.exe /s /k pushd \"%V\""

    Now I have the enhanced context menu at the folder and a double click on file:///c:\tmp starts the windows file explorer.

    Remark: The items in the submenu are displayed by the lexical order (1. command-exec, 2. runas …).

    Thanks for you help.

    Kind Regards
    Thomas

  • Find line before specific text

    2
    0 Votes
    2 Posts
    363 Views
    guy038G

    Hello, @elise-baribault and All,

    Not difficult with regular expressions !

    Open the Mark dialog ( Ctrl+ M )

    SEARCH (?-si)^EL[:;]\x20\K\d+(?=\R.+\RABNORMAL PROGRAM STOP$)

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

    Un-tick all other box options

    Select the Regular expression search mode

    Click on the Mark All button

    Click on the Copy Marked Text button

    Open a new tab ( Ctrl + N )

    Paste the clipboard contents ( Ctrl + V )

    Et voilà !

    After clicking on the Mark All button you may, either :

    Right-click into the bookmark margin and choose the Copy bookmarked Lines option

    Use the menu option Search > Bookmark > Copy Bookmarked Lines

    Best Regards

    guy038

  • User Extensions for Language Recognition not working for custom styles

    7
    0 Votes
    7 Posts
    352 Views
    Tobias GebhardT

    Ok, I checked with the original Obsidian.xml and it works now.
    Although the Lua block is the same, this strange behavior still exists. (They are only differences in other languages or maybe because of Global Style).
    If anyone wants to further investigate, I would upload the files here, but I can’t.

    Anyway, thank you for the help.

  • Declare and Underscor Multiple Variables

    7
    0 Votes
    7 Posts
    261 Views
    guy038G

    Hello, @Nathan-heath, @peterjones, @alan-kilborn, @astrosofista and All,

    Here is my contribution, which merge the two regex S/R in one S/R only :

    SEARCH (?-i)^(?!Double|$)|^Double\h

    Replace Double_

    So, from your example :

    Double Infuse with Vitality; Double Inkling Summoning; Double Kasmina Enigma Sage;//Kasmina comma Double Killian Ink Duelist;//Killian comma Double Lorehold Apprentice; Double Lorehold Command; Double Lorehold Excavation; Double Lorehold Pledgemage; Double Maelstrom Muse; Double Magma Opus; Double Make Your Mark; Double Manifestation Sage; Double Moldering Karok; Double Mortality Spear; Double Needlethorn Drake; Double Oggyar Battle-Seer; Double Owlin Shieldmage; Double Pest Summoning; Double Practical Research; Prismari Apprentice; Prismari Command; Prismari Pledgemage; Quandrix Apprentice; Quandrix Command; Quandrix Cultivator; Quandrix Pledgemage; Quintorius Field Historian; Radiant Scrollwielder; Reconstruct History; Relic Sloth; Returned Pastcaller; Rip Apart; Rise of Extus; Rootha Mercurial Artist; Rushed Rebirth; Shadewing Laureate; Shadrix Silverquill; Silverquill Apprentice; Silverquill Command; Silverquill Pledgemage; Silverquill Silencer; Spectacle Mage; Spirit Summoning; Spiteful Squad; Square Up; Stonebound Mentor; Tanazir Quandrix; Teach by Example; Tend the Pests; Thrilling Discovery; Vanishing Verse; Velomachus Lorehold; Venerable Warsinger; Witherbloom Apprentice; Witherbloom Command; Witherbloom Pledgemage;

    You should get the expected output :

    Double_Magma Opus; Double_Make Your Mark; Double_Manifestation Sage; Double_Moldering Karok; Double_Mortality Spear; Double_Needlethorn Drake; Double_Oggyar Battle-Seer; Double_Owlin Shieldmage; Double_Pest Summoning; Double_Practical Research; Double_Prismari Apprentice; Double_Prismari Command; Double_Prismari Pledgemage; Double_Quandrix Apprentice; Double_Quandrix Command; Double_Quandrix Cultivator; Double_Quandrix Pledgemage; Double_Quintorius Field Historian; Double_Radiant Scrollwielder; Double_Reconstruct History; Double_Relic Sloth; Double_Returned Pastcaller; Double_Rip Apart; Double_Rise of Extus; Double_Rootha Mercurial Artist; Double_Rushed Rebirth; Double_Shadewing Laureate; Double_Shadrix Silverquill; Double_Silverquill Apprentice; Double_Silverquill Command; Double_Silverquill Pledgemage; Double_Silverquill Silencer; Double_Spectacle Mage; Double_Spirit Summoning; Double_Spiteful Squad; Double_Square Up; Double_Stonebound Mentor; Double_Tanazir Quandrix; Double_Teach by Example; Double_Tend the Pests; Double_Thrilling Discovery; Double_Vanishing Verse; Double_Velomachus Lorehold; Double_Venerable Warsinger; Double_Witherbloom Apprentice; Double_Witherbloom Command; Double_Witherbloom Pledgemage;

    In addition, if you re-run this regex S/R, nothing else is matched and replaced. Nice, isn’t it ?

    Best Regards,

    guy038

  • Difficulty with using backreferences/capture groups in find/replace.

    5
    0 Votes
    5 Posts
    290 Views
    guy038G

    Hello, @james-norton, @alan-kilborn, @terry-r and All,

    BTW, note that there’s an important difference between :

    To search for IPV4 addresses, in a file containing valid IVP4 addresses, only

    To search for valid IPV4 addresses, in a file which may contain some non valid IPV4 addresses !

    In the first case, as the @terry-r’s solution, simply use the almost obvious regex \b(\d{1,3}\.){3}\d{1,3}\b

    In the second cas, use one of the two regexes, below :

    (25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(*FAIL)|\b((?1)\.){3}(?1)\b

    (?(DEFINE)(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))\b((?1)\.){3}(?1)\b

    Notes :

    In the first regex, once the part (25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d) is stored as group 1, the (*FAIL) control verb discards this match but this regex part can be re-used with the syntax (?1). Then, the second alternative \b((?1)\.){3}(?1)\b does match a valid IPV4 address !

    The second regex uses a special conditional syntax with the key expression (DEFINE). which stores, as above, the part 25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d, between parentheses, but which is never matched, by definition. So the effective regex is just the part \b((?1)\.){3}(?1)\b, coming next, which match valid IPV4 addresses only

    Best Regards,

    guy038

  • Find files with multiple Strings

    5
    0 Votes
    5 Posts
    2k Views
    PeterJonesP

    All,

    See also my in-development expressions for generic logic “gates” in regular expressions: AND, OR, XOR, NOR, NAND

    Some day, they might get a blog post all of their own, rather than be buried in that thread. But they are still in-development, so they’ll stay there for now.