• How to save file with new Encoding ??

    2
    0 Votes
    2 Posts
    10k Views
    PeterJonesP

    @Kamil-Dvoracek ,

    You probably have Settings > Preferences > New Document > Encoding > [UTF-8] Apply to opened ANSI files checkmarked.

    6fce41b1-08fb-4b59-a055-78e71ac9a739-image.png

    This says “if I open a file that appears to be an ANSI-encoding file, instead open it as UTF-8”. If that’s not what you want, then uncheck that option.

    Also, Settings > Preferences > MISC > Autodetect character encoding is not always right, so be warned that even when you do have a file in ANSI, it might guess the wrong ANSI encoding, because no heuristic is perfect. (Unfortunately, in the early days of DOS, they didn’t think that storing encoding information as metadata in the FAT would be worthwhile, though it would have saved decades of problems; and the FAT32 and NTFS never rectified that; so all that modern text editors have to go on is imperfect heuristics, rather than having metadata that saves the actual encoding with the rest of the file name and size and date information. We might even be able to throw the blame all the way back to CP/M rather than DOS; I don’t know how far back that particular backward-compatibility goes. That’s why some file types, like XML/HTML, allow embedding the encoding inside the file; and why some editors will honor the modeline commands inside your source files; using the EditorConfig plugin, Notepad++ honors some, but doesn’t yet honor the encoding from a modeline)

  • Update lost configuration, can't find a "fix" that sticks

    9
    0 Votes
    9 Posts
    1k Views
    Lycan ThropeL

    @K-M-Richards ,
    Glad that worked for you, I thought it might. Feel free to use the version that works for you, as I’m glad old versions are available to be downloaded, as not all software developers keep their old programs to be used after they’ve moved on to a newer version.

  • Another help: conditional replace.

    7
    0 Votes
    7 Posts
    307 Views
    João BorlothJ

    Thanks for all.

  • How to change default Powershell language so "$" is Green

    3
    0 Votes
    3 Posts
    264 Views
    guy038G

    Hello, @cooly0, @mark-olson and All,

    @mark-olson, from your picture, the first $ sign, in the part between quotes :

    del "$($vsTemplatepath)\nppplugin*.zip"

    Is not colored in green. This is quite normal as your regex is \$(?=\w). I suppose that the correct regex should be, in this case, \$(?=[\w(])

    So, it’s not a limitation of the @Ekopalypse’s plugin !!

    Best Regards,

    guy038

  • Conditional Replace Char

    3
    0 Votes
    3 Posts
    259 Views
    João BorlothJ

    @Coises , thanks.
    Worked perfectly.
    I did a test, using a letter and not the hyphen.
    In this case, it was exactly the opposite, replacing the isolated letter, not the letter in the middle of the word. So here we have a new trick: finding loose letters in the text.

  • running bat files

    5
    0 Votes
    5 Posts
    310 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
    1k 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
    182 Views
    No one has replied
  • ligature in/dans a/une macro

    24
    0 Votes
    24 Posts
    2k 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
    281 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
    545 Views
    jonnieg4rdnerJ

    @Alan-Kilborn Perfect!!!

    Thanks for your help.

  • button, menu, tooltip color

    2
    0 Votes
    2 Posts
    311 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
    271 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
    406 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
    242 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
    297 Views
    No one has replied
  • moving year in a date from the end to the front.

    27
    0 Votes
    27 Posts
    2k 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
    363 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
    356 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.