• Regex searching for NUL characters

    5
    2 Votes
    5 Posts
    3k Views
    guy038G

    Hi, @alan-kilborn and All,

    Here is a solution, as a work-around, to manage the presence of the NUL character(s) in a file :

    Choose an other character, not used, yet, in your file. Let’s take the \x{007F} control character Delete

    So, you first run the regex S/R, below, with the Wrap around option and the Regular expression search mode

    SEARCH \0

    REPLACE \x7F

    Then you perform all your text manipulations, in Notepad++

    Finally, save your file and exit N++

    As we cannot insert any NUL character, with an N++ replacement, we’ll simply use the well known utility sed.exe

    You can download its last Windows v4.8 - 64 bits version, from https://github.com/mbuilov/sed-windows

    Or other versions, from https://github.com/mbuilov/sed-windows/tree/master/archive

    Then, in a DOS console window, type in and execute this simple command :

    sed.exe -i s/\x7f/\x00/ Your_File

    Best Regards,

    guy038

  • Find and Insert rather Replace

    3
    0 Votes
    3 Posts
    2k Views
    Alan KilbornA

    Another technique is to use \K at the end of your find string.
    In that usage you then do not use ${0} in the replace.
    Your replacement string will be inserted at the end of the text your find string matches.
    I mention this usage because that seems to be what you are needing.

    However, if you ever have a situation where you want your find string text to be in the middle of a replacement, then the ${0} usage is the solution.

  • [FunctionList] Regex OK in Regex101 but broken in N++

    11
    1 Votes
    11 Posts
    794 Views
    Mateos81M

    It’s a montage made by a contributor to show me what he’d like to have, and since that was exactly what I wanted myself, I took the picture and forwarded it over here ^^’

    You can see there’s a gray line hanging kind-of off, but still I’ve asked him to be sure, and yes it was a montage (else he’d have pushed his script to the repo I guess)

    Thanks for the clarifications @MAPJe71 :)

    So we can’t push more forward for now; thank you very much to all of you following and helping on this topic!

    Take care people

  • 2 Votes
    1 Posts
    99 Views
    No one has replied
  • Make Regex for anti swear

    2
    0 Votes
    2 Posts
    223 Views
    Alan KilbornA

    @Fabio-grossi

    Regex isn’t going to be able to help you with this task.

  • Delete with Replace mode!

    3
    0 Votes
    3 Posts
    149 Views
    cmeriauxC

    sorry @guy038 I stole the regex star from you ;-)

  • Filter the data !!!

    63
    0 Votes
    63 Posts
    12k Views
    EkopalypseE

    @guy038

    This is how it looks on your system, but I assume it might look different on a system where OSMANYA is more common.
    That is, of course, if there is a localized version of Windows that OSMANYA takes into account.

  • find group of machting characters

    3
    0 Votes
    3 Posts
    152 Views
    Alan KilbornA

    @bowoo-king said in find group of machting characters:

    duplication of a group of 8 characters in a string

    The example showed digits so that’s what my solution was tailored to.
    But…
    If it is truly “characters” then this might be more appropriate:
    (?-s)(.{8}).*?\1

  • Supported versions of Notepad++

    2
    0 Votes
    2 Posts
    168 Views
    Alan KilbornA

    @Mary-Lou-Sullivan

    Typically the reality of how it goes is you ask a specific question about what you think is a defect.
    You can do this in about any version you like.
    Probably someone will try out your suspected bug in whatever version they have, in all likelihood a later version than yours.
    If they do not experience the same problem you did, their advice might be for you to upgrade to a newer version and try again.

    If you’re asking if there are dedicate teams supporting each of version 7.1.x, 7.2.x, etc. (or something like that) and then fixing bugs in these specific versions for release as later 7.1.y, etc, then the answer is NO.

  • Using RegEx to format text for import

    5
    2 Votes
    5 Posts
    424 Views
    Makwana PrahladM

    Hello

    List itemIdentify the common text string you wish to remove, in this example, “Accepts Google Pay”

    List itemClick the Column Options dropdown arrow and select Set regular expression. The Set regular expression dialog box appears.

    List itemIn the Match box, enter “Accepts Google Pay\s+(.+)” to identify the Accepts Google Pay string and then capture the remainder of the string in the first capture capture group.

    List itemIn the Replace box, enter $1 to print out the first capture group. The prefix disappears from the column data, leaving the remainder of the string intact.

    I hope this information will be usefull for you.
    Thank you

  • Themes from Style Configurator not applying to User-Defined Languages!!

    2
    0 Votes
    2 Posts
    909 Views
    phenomenal11P

    nevermind… i found the problem… Go to the User Defined Language box and select your language… in the Folders and Default tab click the Styler Tab under “Default Style” and choose your font color and live happily ever after!

  • Mark all in open tabs if found , copy . cut . remove.

    10
    0 Votes
    10 Posts
    420 Views
    Alan KilbornA

    @Ekopalypse

    Well that certainly is very nice.

  • massive bug with comments in user defined language

    5
    0 Votes
    5 Posts
    191 Views
    EkopalypseE

    @audio-scavenger

    yes, looks like force at beginning of line corrupts the styling for some comments.

  • 0 Votes
    10 Posts
    9k Views
    audio scavengerA

    we have the same problem and “Operators & Delimiters” is not a good alternative
    this will highlight as comment all the text that starts with a dash even in the middle of a line which is not what we (and this poster) want

    i installed various older versions of np++ portable and this bug happens between version 6.6.6 and 6.7.9

  • Confused by Doc Switcher MRU vs Recent Files List

    9
    0 Votes
    9 Posts
    714 Views
    Alan KilbornA

    @Mr-Brunes said in Confused by Doc Switcher MRU vs Recent Files List:

    Close button ‘x’ icon (saves right-click > Close)

    Here’s where user preference comes in.
    I dislike an “x” icon of this type.
    This is possible on the existing Notepad++ tab bar, by the way; in fact, it’s the default.
    Why don’t I like it?
    Because I’m far too likely to hit it by accident, and as it is immediate, the tab is simply cooked/over/done-for.

  • Advanced replace

    4
    0 Votes
    4 Posts
    1k Views
    PeterJonesP

    @test-test-0 said,

    @PeterJones said in Advanced replace:

    ^\d{2}:\d{2}:\d{2}\h*

    That’s basically what I want, but sometimes it will be slight difference in the characters order in a specific line that I want to delete.
    In simple words - sometimes the time (like 09:15:01) will be in the middle of a text line, not just in the beginning.
    Here’s an actual example of what I want to do:
    Take out those numbers next to the “Line” word, and additionally delete the date and time from each line.

    When asking for search-and-replace help, context in regular expressions is everything. If you’re asking for help with regular expressions, you need to be as clear as possible. You said nothing about removing more than just the time.

    I tried to use the syntax in FIND you suggested, unfortunately it didn’t work for me.

    Because the requirements you listed were different than the requirements you had.

    30bc0180-9857-4405-beca-1015a278fbaa-image.png

    You still haven’t followed my advice above – presenting before and after data as text (marked with the </> button so it formats as unmodified text in the forum), so that we can copy/paste your text to experiment with – so we’ve still just got your verbal description of the problem as to what you want it to look like when it is done. So there’s a good chance that this second expression I give you won’t work either, because you have not defined your problem to us sufficiently.

    I am going to assume you want to convert Line NUMBER: DATE TIME TEXT TO KEEP (where DATE and TIME match the YYYY-MM-DD HH:MM:SS,FFF format that you implied this time around; I am just assuming that NUMBER will be an integer with at least one digit) into Line: TEXT TO KEEP, but I will make the replace expression obvious enough that if you don’t want the Line: left in the final result, you can take it out.

    FIND = (?-s)Line\x20\d+:\x20\d{4}-\d{2}-\d{2}\x20\d{2}:\d{2}:\d{2},\d{3}\x20 I used \x20 to indicate the space character, so that there was no question (especially at the end, where I want to delete the final space after the milliseconds as well) REPLACE = Line:\x20 If you don’t want it prefixed with Line: and a space, just leave the REPLACE empty Mode = Regular Expression

    Here is an example it works with:

    Before:

    Line 8: 2020-05-12 12:02:03,789 INFO First Line Line 64: 2020-05-12 12:02:06,789 INFO Second Line Line 512: 2020-05-12 12:02:09,789 DATA Third Line Line 8192: 2020-05-12 12:02:13,789 STUFF Fourth Line Line 16384: 2020-05-12 12:02:16,789 INFO Fifth Line 32768: 2020-05-12 12:02:16,789 INFO Sixth Line 65536: 2020-05-12 12:02:16,789 INFO Seventh Heaven

    After:

    Line: INFO First Line Line: INFO Second Line Line: DATA Third Line Line: STUFF Fourth Line Line: INFO Fifth Line: INFO Sixth Line: INFO Seventh Heaven

    If you need changes compared to this, you will have to do a better job of showing that you want to help us help you. I have already explained how to do this in my first post.

  • Problem with User-Defined Language userDefineLang_AHK.xml

    2
    0 Votes
    2 Posts
    265 Views
    EkopalypseE

    @hardcider09

    Without having a reproducible way to do/observe it, it is hard to say.
    Personally, I use two UDLs quite often and have not observed such behavior, but that doesn’t mean it’s not there, obviously, just that I may not be acting in the order in which you do.

  • Function List - Help for adding a custom language

    Locked
    8
    1 Votes
    8 Posts
    2k Views
    guy038G

    Hi, @mateos81 and All,

    Concerning your present parser :

    <parser id="ob_function_old" displayName="Omni-Bot (old)" commentExpr="((/\*.*?\*)/|(//.*?$))"> <function mainExpr="^[ \t]*(global |member )?([0-9A-Za-z_\.]+)(\ *)\=(\ *)function(\ *)\(([0-9A-Za-z_\,\ ]*)\)" displayMode="$functionName"> <functionName> <nameExpr expr="^[ \t]*(global |member )?\K[0-9A-Za-z_\.]+"/> </functionName> </function> </parser>

    I modified and simplified the different regexes, in the same way I did, in my previous post ! So, I ended up with this version :

    <parser id="ob_function_old" displayName="Omni-Bot (old)" commentExpr="/\*.*?\*/|//.*?$"> <function mainExpr="(?-i)^\h*(global\x20|member\x20)?[\w.]+\x20*=(\x20*function\x20*\([\w,\x20]*\))?\s*\{" displayMode="$functionName"> <functionName> <nameExpr expr="(?-i)^\h*(global\x20|member\x20)?\K[\w.]+"/> </functionName> </function> </parser>

    Remark :

    Because of the in-line // comment, the function AXIS does not appear in the function-list panel. Logical ! AXIS = // Team

    So, three work-around syntaxes are possible :

    AXIS = { // Team AllBots = true, // Each bot is considered for a role

    or :

    AXIS = { // Team AllBots = true, // Each bot is considered for a role

    or :

    // Team AXIS = { AllBots = true, // Each bot is considered for a role

    Note that, with the 1st solution, there must be, at least, two blank characters, between the { and the start comment //, although I don’t understand exactly why ;-))

    Given your example file :    https://pastebin.com/Uk9jdfzw    and using the syntax AXIS = { // Team, the function List panel displays the 22 elements, below :

    Map Navigation jump navigate Roles AXIS DEFENDER DEFENDER1 AxisBridgeSuicide OnEnter Test0 Test Test2 Test_3 OnMapLoad OnBotJoin InitializeRoutes MapRoutes BUILD_Command_POST NonFunctionClassLevelTest NonFunctionClassLevelTestWithFunction Test

    I didn’t study your enhanced parser, with classRange node, yet ! I hope to be able to get some results as I know very little about objects classes :-((

    Cheers,

    guy038

    P.S. :

    To test your parser, I used the following association

    <association id= "ob_function_old" langID= "0" />

    which enabled me to simply use Normal Text language ;-))

    IMPORTANT : Follow the link, below, for further discussion !

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

  • Highlighting not functioning at all

    3
    0 Votes
    3 Posts
    795 Views
    Charles BogelC

    Thanks for reply. I forgot to mention I had tried various styles, and the problem persists. Here is a screenshot of that same screen, keeping in mind the background I have hit ctrl-a and the entire document is selected.

    ![0_1589320101262_7bb2a215-cfd1-47cb-b262-6a3788ebbd99-image.png](Uploading 100%)

    https://i.imgur.com/14o0u6q.png

  • Use Text File to Remove Lines?

    9
    1 Votes
    9 Posts
    3k Views
    guy038G

    Hi, @mrmagnum8841, @peterjones, @alan-kilborn and All,

    When elaborating my previous post, I remenbered, from this post :

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

    This following regex (?-s)^(.+\R)(?=(?s).+?^\1), which, indeed, could work with a 5 Mb file ,containing more than 200,000 lines ! Much better, isn’t it ?

    Seemingly, the fact that, in this regex, the group 1 corresponds to an entire line, with its line-break, whereas the (?-si)^.*,\x20(\w+),.*\R(?=(?s).+?^\1$) syntax stores, only, the ID### part, of each line, in group 1 ( which fails with a file over 82 Kb - 2,500 lines ! ) makes all the difference !! Why ?

    As you said, Peter, it was a mental exercise, not specifically intended for the OP, in order to find a correct way to filter fairly large files, as I’m rather irritated by the limitations of my various regular expression attempts :-((

    Cheers,

    guy038