• Add something before a specific word with regex

    3
    0 Votes
    3 Posts
    3k Views
    Robin CruiseR

    FIND: (.*)(life elsewhere)

    REPLACE BY: \1SECRET \2

  • Find&Replace in one column

    7
  • 1 Votes
    5 Posts
    409 Views
    guy038G

    Hello, @robin-cruise, @Terry-R and All,

    Why not this simplified version :

    SEARCH (?-is)2002(?=.*Michael)

    REPLACE 2012

    Notes :

    The regex searches for the string 2002 ONLY IF  , further on, in current line, the string Michael, with that exact case, can be found

    If so, it is replaced with the string 2012

    In case, the forename Michael could be located before the 2002 string, here is an improved version taking the two cases in account :

    SEARCH (?-is)2002(?=.*Michael)|Michael.*\K2002

    REPLACE 2012

    Use the Replace All button, only !

    Best Regards,

    guy038

    P.S. :

    Oh…, I’ve just seen the @alan-kilborn version which is really clever as it does not need an alternative ;-))

    So, I just added the (?-i) modifier, if necessary and the \K feature to avoid any group :

    SEARCH (?-is)^(?=.*?Michael).*\K2002

    REPLACE 2012

    Use the Replace All button, only !

  • How to open multiple urls at once?

    3
    0 Votes
    3 Posts
    4k Views
    prahladmifourP

    Hello,@Bruno-Martinha
    Please you have open multiple URLs at once to use the CMD batch script file for this and insert the command below in the batch script file:

    FOR /F %%link IN (<your text file.txt>) DO start chrome %%link

    I hope this information will be useful to you.
    Thank you.

  • Regex: Rename Duplicate lines with <!— comments -->

    3
    0 Votes
    3 Posts
    263 Views
    Robin CruiseR

    In my case, I wanted to exchange something between the comments, and I have more comments. So, to do that I had to rename the comments so as not to change everything, and only certain comments.

  • Keyboard app please help.

    2
    0 Votes
    2 Posts
    221 Views
    PeterJonesP

    @Nightcore-AMV ,

    I believe this applies:
    https://community.notepad-plus-plus.org/topic/15958/faq-desk-you-ve-asked-your-question-in-the-wrong-place

    You seem to be asking a programming question, which is agnostic of what editor you use. This forum is about the Notepad++ editor itself, and not a general programming-q-and-a forum.

  • Replacing word between commas not included in a list of words

    12
    0 Votes
    12 Posts
    1k Views
    fred zeptF

    First of all I have to say that I’m amazed about this group and the level of competence you guys have.
    I just got the time to work on this project and here what I have found.

    @astrosofista said in Replacing word between commas not included in a list of words:

    Hi @fred-zept

    Please, try the following regex, based in the expressions provided yesterday:

    Search: ^((([^,]*),){22}(?!bianco|nero|rosso|giallo|blu|verde|arancione|grigio|viola|marrone|mimetico|beige|bordeaux))([^,]+) Replace: ${1}altri

    Have fun!

    Thanks, this seems to work on most of the lines. In some other line seems to change the value on the 21st comma rather than 22nd.
    It works on the first line, although on the second line change the word Topman, which is the brand and not the colour, rather than Pietra

    https://www.awin1.com/pclick.php?p=27397554539&a=357849&m=9606,"adidas Originals - Smanicato con 3 strisce nero",27397554539,9963546,https://images.asos-media.com/products/adidas-originals-smanicato-con-3-strisce-nero/20192202-1-black?$XXL$,"Gilet di Adidas Originals Il prossimo dei tuoi prodotti salvati Modello imbottito Collo a imbuto Logo Adidas Chiusura con zip Tasche laterali 3 strisce laterali Vestibilità classica Veste perfettamente la taglia indicata","Uomo > Giacche e cappotti > Gilet",74.95,"Asos.com IT",9606,"Men's Outerwear",171,https://images2.productserve.com/?w=200&h=200&bg=white&trim=5&t=letterbox&url=ssl%3Aimages.asos-media.com%2Fproducts%2Fadidas-originals-smanicato-con-3-strisce-nero%2F20192202-1-black%3F%24XXL%24&feedId=36675&k=1f40920a1b687eb73ed4ce4da992ec98bfaf0279,EUR,,0.00,https://www.asos.com/it/adidas-originals/adidas-originals-smanicato-con-3-strisce-nero/prd/20192202?browseCountry=IT&browseCurrency=EUR,,,EUR74.95,36675,"adidas Originals",Porpora,,25479,,,,,"74.95 €","0.00 €",,, https://www.awin1.com/pclick.php?p=27250398127&a=357849&m=9606,"Topman - Piumino smanicato riciclato color pietra",27250398127,10155883,https://images.asos-media.com/products/topman-piumino-smanicato-riciclato-color-pietra/20571492-1-stone?$XXL$,"Giacca di Topman Non oggi, per quando fa freddo Collo a imbuto Senza maniche Chiusura con zip Tasca con zip sul petto Tasche laterali Vestibilità classica Veste perfettamente la taglia indicata","Uomo > Giacche e Cappotti > Gilet",55.99,"Asos.com IT",9606,"Men's Outerwear",171,https://images2.productserve.com/?w=200&h=200&bg=white&trim=5&t=letterbox&url=ssl%3Aimages.asos-media.com%2Fproducts%2Ftopman-piumino-smanicato-riciclato-color-pietra%2F20571492-1-stone%3F%24XXL%24&feedId=36675&k=2bd6e17c0634ad74c710a431ab947d5e483b4d4c,EUR,,0.00,https://www.asos.com/it/topman/topman-piumino-smanicato-riciclato-color-pietra/prd/20571492?browseCountry=IT&browseCurrency=EUR,,,EUR55.99,36675,Topman,Pietra,,25487,,,,,"55.99 €","0.00 €",,,

    @guy038 your solution seems to work perfectly.

    @Terry-R I guess I’m in the middle of the good ones since I live in in Europe. And you are a good one for sure Terry, I’m still using your way to delete near duplicate lines.
    Thanks again.

    Thanks everyone for your help!

  • replace words between tags with regular expression

    10
    0 Votes
    10 Posts
    3k Views
    Robin CruiseR

    thank you !

  • How to fold code in a specific manner?

    5
    0 Votes
    5 Posts
    3k Views
    Trey SutphinT

    @Ekopalypse thanks for the suggestion. Unfortunately the file structure is what I would call a little “wonky”, with similar elements existing on different levels, so I don’t think defining a UDL alone won’t get me there. In any case I appreciate your response!

  • How to separate words of specific strings?

    6
    0 Votes
    6 Posts
    2k Views
    Faisal AlamF

    @guy038 thank you so much from my deep heart. I really appreciate your efforts towards an stranger like me. And i will definitely try learning from links provided by you. Thanks again.

  • How to separate two numbers from text?

    6
    0 Votes
    6 Posts
    747 Views
    Alan KilbornA

    @Ekopalypse said in How to separate two numbers from text?:

    but just thought, hey, this can be done easily without regex.

    Yes and you present a good technique, something interesting to the forum.

    those who want to give answers should be allowed to do so

    Surely, and I can’t stop them.
    Just my efforts to keep us on track, and not being a continual back-and-forth data translation service for those that don’t choose to go off and learn how to do their own, with the basics given here.

  • Help with replace expression

    3
    0 Votes
    3 Posts
    913 Views
    asaan hamdyA

    Thank you so much

  • 0 Votes
    7 Posts
    1k Views
    PeterJonesP

    @ljhmily said in settings--preference--language style setting--bash--instruction word,is the keywords has number or word limit?:

    i added some keywords, like su wget api ssh, but only su wget ssh worked, the api and others not.

    su and wget are already keywords (INSTRUCTION WORD), so you don’t need to add them.

    And when I add api ssh to the list, they immediately start highlighting:

    But, as @Terry-R said,

    further test seems to show only the word against the margin will highlight if amongst the user added words

    It’s more nuanced than that, as shown by my screenshot:

    d5b9e1be-2492-4aca-a09c-f6d917a84620-image.png

    cat api only marks cat as a keyword because in the grammar of bash, cat is in the location of a command, but api is not (it’s the argument, not the instruction). But api blah at the beginning of the line will allow api to be recognized as an INSTRUCTION WORD, because it is grammatically where an instruction should be. Further, on my examples with | pipes and & or ; separators, the first word after the separator can also be recognized as an INSTRUCTION WORD, too… because they are instructions.

    You might try to argue that something like
    edec2c4f-2917-4462-b8a3-0e881bd569c9-image.png
    should highlight the ls as well as the ssh, because ls is also a command… but really, it’s not a command in terms of the bash script running on the local machine – it’s only a command once it’s sent all the way to the remote connection.

    similarly, ansible -vv api -m copy has -vv, api, -m, and copy as arguments, not as instructions, so only the ansible is a potential instruction word… and since it’s not a builtin keyword nor in my list of user-defined keywords, it is not highlighted.

    So, personally, I consider the bash/unix-shell syntax highlighter to be working correctly; according to the grammar that’s built into the lexer, it is highlighting the builtin or user-defined keywords when they are grammatically being used as instruction words, and only then. If you consider that a bug (I do not), this forum is not the right place to report it; in fact, the Notepad++ project is even the wrong place to report it, because the bash lexer is defined/coded in the Scintilla project which Notepad++ uses for that feature. You would have to go report that bug to Scintilla; once/if they fix it, you would then have to ask Notepad++ to upgrade to the newer Scintilla.

    However, you can add extra highlighting to a builtin lexer (like the bash/unix-shell lexer) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo. Those regexes wouldn’t be limited by the bash/unix-shell grammatical constraints, so if you defined a regex like \b(api|ssh|ansible)\b, it would highlight those words under the scripts color definitions whenever they were found, not just in grammatically instruction-word locations.

  • Help coding text errors

    4
    0 Votes
    4 Posts
    2k Views
    caryptC

    this is my poor attempt to help . it might contain error possibilities : so be careful . i havent concerned line-breaks (end of line) in my try . please correct me if you know . i would also suggest to use the search /mark funktion and then manually correct the mistakes step by step .

    i see one problem-case always has quotes at start and end , and sometimes ongoing sentence , also upper and lower case .
    search phrases example 1(period into comma) : ("\u.*)(\.)(")( \u.*)(\.) replace : $1,$3$4$5 . (the brackets define arguments and $number define the numbered backreferences for the former arguments , dot is any character , * means repetion , . (escaped dot) means the real dot-character ,\u means upper case character , \l lower case character, \s is space character)
    example 2 (missing comma) : s: ("\u.*)(")(\u.*)(\.) r: $1,$2$3$4 .
    example 3 (comma into period) s: ("\u.*)(,)(") r : $1.$3 .
    example 4 s: ("\u.*)(\.)(")(\u.*)(,)("\u.*)(\.)(") r: $1,$3$4.$6$7$8 .
    example 5 (finding missing period) s : (\u.*)(\s\u.*\.) r : $1.$2 .

  • Issues with npftp and ionos (1and1) sftp

    3
    0 Votes
    3 Posts
    795 Views
    PeterJonesP

    @asirota said in Issues with npftp and ionos (1and1) sftp:

    something special that’s changed in a recent version of Notepad++

    Please note that NppFTP is a separate entity from Notepad++. The “problem” is likely in the plugin, not in Notepad++ itself (because Notepad++ itself knows nothing about SFTP or any other such protocol).

    Sometimes, due to the OpenSSL library used by NppFTP plugin, the encryptions/etc that NppFTP knows about is different from the encryptions/etc that your server is willing to use. I have that problem with at least one server.

    However, based on the error messages, it appears your host doesn’t want password authentication. My guess is that in FileZilla, you have that host set to use an SSH key to log in, rather than a password, but that you aren’t trying SSH key with NppFTP. You might have to enable the private key checkbox and fill in the private key file location for the IONOS profile:
    0af9b7cb-38a9-4677-9c37-5122c5aaaf05-image.png
    (I think at one point, I also had NppFTP working with pageant or a pageant-equivalent SSH key agent, but I don’t currently have an example of that working available right now, so I don’t remember how it all worked together – but I think it had the checkbox enable but no keyfile in the text box in those settings.)

    If that doesn’t help you, I’m not sure how much more we’ll be able to help you here.

    If you look on your Plugins > NppFTP > About,
    adc919e0-ce33-410a-887c-ca6d1085abb9-image.png
    … you will see the Visit NppFTP site which then links to the NppFTP issue tracker, which is where you would go for help specifically on NppFTP. I would recommend, since you can successfully connect to that site using FileZilla, but not with NppFTP, that you share you NppFTP profile settings and the FileZilla profile settings in that issue you create over there. (If you do create an issue with NppFTP issue tracker, it’s generally considered polite to paste a link to the issue you create in this thread, so that anyone who reads your request here can follow it to its conclusion over there.)

    As a workaround for sites that I couldn’t get to work in NppFTP (in the days before my IT department uninstalled FileZilla for me), I would set up FZ to use Notepad++ for the editor, and then I would use FileZilla’s remote-edit feature to edit remote files through FZ using Notepad++. Using FZ+NPP vs NPP+NppFTP were very similar workflows for me, and it didn’t bother me to switch between the two.

  • Override Default Style Colors in Custom Language

    6
    1 Votes
    6 Posts
    2k Views
    ArkadiuszMichalskiA

    I remember having a similar problem in the past, I wanted the default colors everywhere except my UDL. Thanks for the tip above, I will check later if it works for me.

  • line by line modification using macro

    9
    0 Votes
    9 Posts
    3k Views
    TroshinDVT

    @Alan-Kilborn said in line by line modification using macro:

    A script feels a bit “heavy” for this simple operation.

    This is if we mean only this operation.
    In fact, there are many possibilities as the brackets are customizable.
    Often it is necessary, for example: to complete the lines on the right or left.

  • How to add an new entry in the "FunctionList"?

    14
    0 Votes
    14 Posts
    3k Views
    Magnus BerglundM

    @PeterJones
    Hello Peter,
    What a fantastic zipfile! :-)
    It works even for me, jippy!

    Thanks for the support!
    Have a great Christmas together with your family

  • Copy Find Result

    9
    0 Votes
    9 Posts
    10k Views
    caryptC

    Aaaahhhh ! yes , thats it . shame on me , i was not updated to 7.9.1 . i beg your pardon , but there is no excuse . shame on me

  • Limit display to lines with content to the left of "x".

    6
    0 Votes
    6 Posts
    2k Views
    fred339F

    @PeterJones Thank you! That works nicely. It appears that a “level” is defined by the appearance of a curly bracket - which is fine.