• running bat files

    5
    0 Votes
    5 Posts
    360 Views
    Alan KilbornA

    @zeta-orionis

    Example with spaces:

    e76fd26d-a003-4fa9-abe4-c5c32d85d815-image.png

  • 0 Votes
    4 Posts
    1k Views
    Mark OlsonM

    @Vasile-Caraus said in Regex: Delete all html tags inside 2 other tags, except <a href=.*?"> and </a>:

    And how did you convert the text ?

    I just used the find/replace form, with regular expressions on.

    thanks a lot. But how did you manage to find this solution?

    Since you’ve taken an interest, I’ll give a pretty detailed explanation of my regex.

    By the way, I have a slight update that should work just as well, but is simpler:
    Replace (?s-i)(?:<p[^>]*>|(?!\A)\G)(?:(?!</p>).)*?\K<(?!(?:/[ap]>|a\x20))[^>]*> with nothing.

    It’s modeled off of guy038’s now-famous replacing in a specific region of text regex. I won’t explain all the parts of this regex that are indebted to that; you can just read his excellent explanation in the linked post. Specifically, the BSR is <p[^>]*>, which is an opening p tag, and the ESR is </p>, the closing p tag. So far this accounts for the first part of the regex, (?s-i)(?:<p[^>]*>|(?!\A)\G)(?:(?!</p>).)*?\K. But the tricky part is matching only tags other than <a> and the closing </p> tag. We know that any tag we want to remove contains <[^>]*>, that is, an opening <, some stuff, and a closing >. To distinguish the tags we want to remove, we’ll do a negative lookahead right after the opening <, so we get <(?!{%distinguishing text%})[^>]*>. Let’s start by observing that the tag cannot be a closing a or p tag. This is the /[ap]> branch of the negative lookahead, where [ap] simply means “a or p”. Next we need to rule out opening a tags. This is the a\x20 branch of the negative lookahead. By the way, \x20 is just another way to say space, as in the space you make with your space bar. Regex aficionados like to use \x20, because it can’t be mistaken for any other character. So we arrive at the final regex, (?s-i)(?:<p[^>]*>|(?!\A)\G)(?:(?!</p>).)*?\K<(?!(?:/[ap]>|a\x20))[^>]*>
  • Regex: How to get off the connecting line from the title of a hyperlink?

    7
    0 Votes
    7 Posts
    2k Views
    Vasile CarausV

    @guy038 I use https://chat.openai.com/ to find different solution. ChatGPT learns everything. In about 5 seconds generates another 4 solutions.

    I just put your regex as an example, and I ask ChatGPT to write me another 4 solution. Is the most inteligent tood ever. Artificial Inteligent.

    :
    Căutare: (?-s)(\G(?!^)|html">)((?!</a>).)*?\K-
    Înlocuire: \x20

    Căutare: (?-s)(\G(?!^)|html">)((?!</a>).)*?\K-
    Înlocuire: \x20

    Căutare: (?-s)(\G(?!^)|html">)((?!</a>).)*?\K-
    Înlocuire: \x20

    Căutare: (?-s)(\G(?!^)|html">)((?!</a>).)*?\K-
    Înlocuire: \x20

  • Windows 11 uninstalled fails

    1
    0 Votes
    1 Posts
    233 Views
    No one has replied
  • ligature in/dans a/une macro

    24
    0 Votes
    24 Posts
    7k Views
    PeterJonesP

    @wonkawilly ,

    Npp UI Spy plugin

    That’s a great place to get the menuCmdId codes like 42024 that were mentioned – those are the command ID values for all the Notepad++ menu entries. (The type="2" codes, as described in the config files: macros section of the Online User Manual.)

    because Scintilla commands are numerous

    Scintilla commands are not included in Npp UI Spy plugin, since they aren’t UI menu commands, so no matter how numerous they are, you will find 0 of them in the Npp UI Spy plugin.

    However, you can find the Scintilla numbers enumerated and briefly described in the Scintilla.iface which linked from that same section of the Online User Manual. And the Manual also links to the canonical sources for the menuCmdId values.

  • Regular expression match to the end not to selected

    3
    0 Votes
    3 Posts
    604 Views
    Danek SzczepanD

    @Alan-Kilborn said in Regular expression match to the end not to selected:

    @Danek-Szczepan said in Regular expression match to the end not to selected:

    notepad++ select from <p><!-- (first line in file) (to last line in file that contains) --></p> How to fix it?

    Change your usage of .* to .*?.

    Learn more starting HERE.

    Working, thank You !

  • Replace folder path using wildcard

    5
    0 Votes
    5 Posts
    1k Views
    jonnieg4rdnerJ

    @Alan-Kilborn Perfect!!!

    Thanks for your help.

  • button, menu, tooltip color

    2
    0 Votes
    2 Posts
    372 Views
    TBugReporterT

    For the sake of anyone who might come across this in the future looking to solve a similar problem: The answer isn’t in the Style Configurator, it’s in the Preferences.
    Screenshot 2023-06-22 001611.png
    This is how my program was configured both before and after I fixed the problem. To fix it, I briefly selected a different option in this dialog and immediately reselected the original. I don’t know why this was claiming to be using the settings shown when they were only partially in effect. I would file a bug report, but I don’t know what I did to break this, so I can’t reproduce it.

  • Repeat lines and add empty lines after every line

    5
    0 Votes
    5 Posts
    327 Views
    J

    @Terry-R said in Repeat lines and add empty lines after every line:

    intention to be using these regexes independently

    Yes, it was my intention to be using these regexes independently - so the ones provided @Mark-Olson are perfectly fine. It’s incredible how helpful and fast responding this community is - I haven’t seen that before. Thanks a lot to you all!

  • finding a partial number with Wildcard

    6
    0 Votes
    6 Posts
    506 Views
    Mark OlsonM

    Suppose you want to find text in AcctNbr tags containing the numbers 48, 17, and 34 in any order. You could enumerate every possible ordering of those numbers, but that would become increasingly intractable as the number of things to be matched got larger (e.g., there are 24 possible orderings of four distinct things). This is where forward lookahead really shines.

    (?-si)<AcctNbr>(?=(?:(?!</AcctNbr>).)*?17)(?=(?:(?!</AcctNbr>).)*?34)(?=(?:(?!</AcctNbr>).)*?48).*?</AcctNbr>

    Try that out on the below text to see what I mean.

    <AcctNbr>1 2 3 4</AcctNbr> <AcctNbr>1 2 23 14</AcctNbr> <AcctNbr>27</AcctNbr> <AcctNbr>1234</AcctNbr> <AcctNbr>34 18</AcctNbr> <AcctNbr>48734</AcctNbr> <FooNbr>34 17 48</FooNbr> <!-- last three should match --> <AcctNbr>34 17 48</AcctNbr> <AcctNbr>4817 34</AcctNbr> <AcctNbr>483417</AcctNbr>

    NOTE: this method allows overlap between things to be matched, e.g., 348 would count for both 34 and 48. There is no efficient way to do this without making the regex much nastier.

  • PythonScript wrap around find/replace

    4
    0 Votes
    4 Posts
    327 Views
    M Andre Z EckenrodeM

    @Alan-Kilborn , @PeterJones :

    Thanks for weighing in. What I’m trying to do is a somewhat complicated regex find/replace on a file roughly represented as such:

    [1st line containing data to be used in replacement elsewhere] […] [2nd line containing data to be used in replacement elsewhere] […] [3rd line containing data to be used in replacement elsewhere] […] [1st line where replacement will take place] […] [2nd line where replacement will take place] […] [3rd line where replacement will take place] […]

    Each instance of […] is one or more lines of other data.

    Starting at the beginning of the file, my FIND pattern will match from [1st line containing data to be used in replacement elsewhere] all the way through [1st line where replacement will take place], then insert data retrieved from the former into the latter, and also deleting all lines from start of file up to but not including [2nd line containing data to be used in replacement elsewhere] in the same process. I was hoping it would be simple to have it go on finding/replacing for all the remaining corresponding line pairs if I could make it use Wrap around and Replace All— though perhaps it wouldn’t, since some of the data within the target match areas will have changed between quasi-iterations — but guess I’ll concede defeat and make a loop. Thanks again!

  • notepad++ 7.8.8 is not working with windows server 2019 (citrix VDI)

    1
    0 Votes
    1 Posts
    358 Views
    No one has replied
  • moving year in a date from the end to the front.

    27
    0 Votes
    27 Posts
    4k Views
    Alan KilbornA

    @Paul-Wormer said in moving year in a date from the end to the front.:

    Why not use \s

    For the same reason that I hesitatingly recommended \h … because it opens up the match to more than what is wanted, a dangerous thing to do with regex.

  • REGEX: a single line should contain each word in a paragraph.

    8
    0 Votes
    8 Posts
    440 Views
    Alan KilbornA

    @Paul-Wormer said in REGEX: a single line should contain each word in a paragraph.:

    Maybe I’m missing the point

    The point you may be missing is that the OP probably has a lot of data to act upon, making doing it “by hand” impractical.

  • How can I update font in npp

    3
    0 Votes
    3 Posts
    591 Views
    Ryuu -R

    @PeterJones Sorry, I don’t know there’s such a thing so I guess npp use some local font.
    This solve my problem, thank you.

  • Extract number between two strings

    2
    0 Votes
    2 Posts
    347 Views
    Terry RT

    @Shahir-Afif said in Extract number between two strings:

    Is there even a possibility to achieve this? I would greatly appreciate your inputs…

    It certainly is possible, and you were on the right track.
    Find What:(?-s).+?object_id=(.+?)sap_archive.+
    Replace With:${1}

    Should work for you.

    If you want more information on what it is doing ask.

    Terry

  • 0 Votes
    4 Posts
    1k Views
    Rob PetersonR

    @PeterJones derived my answer from the discussion post… played around with the values in GUI section of the config and got it working. Thanks again for the assistance!

  • Remove last 5 characters from lines in text file?

    4
    0 Votes
    4 Posts
    4k Views
    M Andre Z EckenrodeM

    @drghty

    By the way, you wrote “remove the last 5 lines from a text file”, but your example indicates removal of the last 5 characters from each line, so I assume the latter was correct.

    @Mark-Olson

    Ah, yes — my bad, and thanks much for the correction.

    For @drghty , just to make sure you understand why Mark’s correction is potentially important, depending on the total content of your text file, my FIND pattern .{5}$ would also match up to five consecutive newline sequences, if your file has multiple consecutive newlines, if it does not include (?-s), or you don’t have . matches newline disabled.

  • Search results editing

    6
    0 Votes
    6 Posts
    1k Views
    Alan KilbornA

    @Tylor-J said in Search results editing:

    I have the same issue.

    If you have a nice, easy reproducible case, probably showing it here helps.

  • Regex mask a list of emails?

    2
    0 Votes
    2 Posts
    811 Views
    guy038G

    Hello, @kraddock and All,

    For your first goal, I propose this regex S/R :

    SEARCH (?!^).(?=.*.@)

    REPLACE *

    And you end up with this OUTPUT text :

    e****1@gmail.com s***********l@icould.com t********l@yahoo.com

    For your second goal, I propose this regex S/R :

    SEARCH (?!^).(?=.*@)

    REPLACE *

    And you end up with this OUTPUT text :

    e*****@gmail.com s************@icould.com t*********@yahoo.com

    For each case, check the Regular expression search box !

    Best Regards,

    guy038