• Keep only last word of each line

    2
    0 Votes
    2 Posts
    741 Views
    Alan KilbornA

    @Vinc-Cser

    Find: (?-s)^.*?(\w+)$
    Replace: ${1}
    Search mode: Regular expression

  • Make NP++ colour scheme to match that of Chrome Developer Tools?

    2
    0 Votes
    2 Posts
    389 Views
    PeterJonesP

    @Scotty-Fitz ,

    You are correct. The codebase that Notepad++ uses for syntax highlighting HTML and related languages applies the same styling to all attributes, so it doesn’t treat the class attribute differently.

    There is an “EnhanceAnyLexer” plugin which can be installed from the Plugins Admin, and it will allow you to define a regex which will look for class="..." and style that text differently than other attributes.

  • New UserDefinedLang - code fold must begin at margin

    4
    1 Votes
    4 Posts
    379 Views
    EkopalypseE

    @gibberishbc

    This is indeed an older thread, your recent threads are others.

    As for the fake return statement, assuming a language doesn’t have start and end tokens like if and endif but does have comments, which is the case in most programming languages, you could use the start token if and a end token like #endif, where # is actually a comment.
    This way, the language itself is still happy when it is executed, and npp (or UDL) knows where to break.

  • find at and copy text to the end of a different line

    4
    0 Votes
    4 Posts
    370 Views
    Alan KilbornA

    @Sibusiso-Dlomo

    So, before text is:

    line 1 line 2 line 3 Name Catch me line 5 Slogan If You Can line 7

    and after text is:

    line 1 line 2 line 3 Name Catch me If You Can line 5 Slogan If You Can line 7

    You could do:

    Find: \A(?-is)(?:.*\R){3}.*\K(?=\R(?:.*\RSlogan(.+)))
    Replace: ${1}
    Search mode: Regular expression

    Other solutions are definitely possible.

  • reGex Find copy and replace to a new line.

    3
    0 Votes
    3 Posts
    697 Views
    Evangelos KosmasE

    Thank you for your direct responce.
    It works great.

    Its perfect

    Thank you again
    Evangelos

  • Find/Replace Regex?

    4
    0 Votes
    4 Posts
    2k Views
    Terry RT

    @Jörg-Winkel said in Find/Replace Regex?:

    It does, however, do exactly what I need today, so thanks a lot for your help.

    I thought I might follow up with some more information as I don’t think you realise how powerful/loose the use of the \D actually is. This post is also for others hoping to learn something.

    \D means “not a digit” which sounds okay until you consider that it really means ANY character that isn’t a digit. So alpha’s are certainly part of that group as the OP wanted. However it also includes punctuation characters such as ;:"',.? and if you see my image, it will include line feed and/or carriage return characters. So ANY character except for the 10 digit ones.
    7c8348e5-542c-4197-b295-b2999b988889-image.png
    The example in the image is admittedly made up on purpose to highlight the power of the \D but it shows how a regular expression (regex) can select other strings in error if one isn’t aware of what it means. Also note that I included a 3 non-digit plus 7 digit string in the example. Again the regex selected the portion it was required to find, that of the 6 digits following the 3 non-digit string. So the 7th digit was excluded. This means upon editing the string we finish up with ;#AB234567;8. I would say that’s a definite error. If only 6 digit strings were to be selected, a test at the end of the find expression would look for 1 or more digits and based on the criteria, either exclude that string or include all of it.

    I’d say this is a prime example of a loosely made expression very likely to have unwarranted side effects.

    Those who do create regexes for others take this into account and is often what we spend more time on, the “edge cases”. Edge cases can be likened to programming where 20% of the code does the work and 80% of the code is error checking. The percentages do vary according to who you talk to but the sentiment still exists across the programming world.

    Terry

  • Document List vs NP++ sessions

    1
    0 Votes
    1 Posts
    171 Views
    No one has replied
  • How to force UDL change to take effect

    7
    0 Votes
    7 Posts
    1k Views
    gibberishbcG

    @PeterJones
    Good catch - thanks!

  • Text Case Formatting

    4
    0 Votes
    4 Posts
    306 Views
    katty perryK

    @Alan-Kilborn said in Text Case Formatting:

    @Mark-Kani

    Take your pick of case-change options:

    1f961d62-bb01-4e86-8c47-eda942d1bab9-image.png

    Don’t be surprised if none of them 100% ever meet your exact need (for your data).

    If you are addicted to the right-click way of doing it, you can customize that menu to add the ones you use most; read about how to do that HERE.

    @Alan-Kilborn said in Text Case Formatting:

    @Mark-Kani

    Take your pick of case-change options:

    1f961d62-bb01-4e86-8c47-eda942d1bab9-image.png

    Don’t be surprised if none of them 100% ever meet your exact need (for your data).

    If you are addicted to the right-click way of doing it, you can customize that menu to add the ones you use most; read about how to do that HERE.

    that is really useful information which you shared , i was also facing the same problem, thanks mate!!!

  • UDL trigger modifiers

    2
    0 Votes
    2 Posts
    258 Views
    EkopalypseE

    @gibberishbc

    the official documentation is here and no, a ^ does not mean it has to be the beginning of a line. If you think this has to do with regex, then no, UDL doesn’t support regex yet.

    The ultimate truth is in the source.

  • Remove tag when using "tab" button

    3
    0 Votes
    3 Posts
    252 Views
    ?

    @PeterJones
    Ok, whatever it is, thanks, you are very helpful.
    My concern was just personal taste when seeing the text in Notepad++.

  • AutoCompletion in Dark Mode

    12
    0 Votes
    12 Posts
    2k Views
    Alan KilbornA

    @Michael-Vincent said in AutoCompletion in Dark Mode:

    setElementColour

    This function does not appear to be a part of PythonScript2.
    I’m not sure why this would be, because PythonScript3 is still considered “beta”…it doesn’t make sense that any advancements wouldn’t be backported, until such time as PS3 is really released and PS2 can be sunsetted.

  • Function lists are empty for C header files

    2
    0 Votes
    2 Posts
    253 Views
    rdipardoR

    The builtin function parser is just a simple regex matcher that expects to see a { after every parameter list. Your source file would have to implement test() for it to appear on the list.

    The smart detection you’re expecting can be provided by a tag parser. One of these plugins may help:

    https://github.com/d0vgan/TagsView/releases https://github.com/pnedev/nppgtags/releases https://github.com/vinsworldcom/nppTagLEET/releases
  • Help wanted with XML editing

    3
    0 Votes
    3 Posts
    507 Views
    PeterJonesP

    @John-Russell ,

    Notepad++ is doing its best in syntax highlighting the invalid XML you are feeding it.

    I confirmed with the Hive Mind that XML comments (<!-- ... -->) are not allowed inside the open tag (<GameData ... >)
    b3b619ac-c834-464f-b02d-920bd0e11487-image.png
    – specifically, that first match is quoting from this SO answer, which links to another one

    For example:
    c6d40b77-02ff-4325-98ca-97ff6b273d82-image.png

    6c647d96-da16-4a1a-8149-c5577c5c7191-image.png

    So the strange highlighting successfully told you that you were doing something wrong. It’s probably time for you to go study XML some more, to better understand the rules for the language. (And this Forum is not the right place for generic XML learning/questions)

  • Can not see images when opening in browser

    6
    0 Votes
    6 Posts
    2k Views
    Lycan ThropeL

    @coleg55 said in Can not see images when opening in browser:

    I will right click that alt portion and will come to a page that says my file does not exist

    In addition to what has been said by Peter and Terry, you also may not have included the full path to that picture, hence, as the document only looks in it’s current directory and if it’s not there, it doesn’t exist, but as the others have stated, that’s a problem of your HTML coding, it has nothing to do with Notepad++.

  • Setting up NP++ on new PC

    9
    0 Votes
    9 Posts
    399 Views
    Betsy GarfieldB

    @alan-kilborn

    Somebody helped me set up the new pc (it’s an old fashioned tower). He downloaded apps from a list I made. I don’t know exactly where or how he did it. The ‘weird icons’ were there and I doubt he fiddled around with those settings. I’m sure he accepted all the default suggestions on first install.

    Thank you for your comments. Thank you all for speedy replies! I appreciate it. If I need more help I will try to be specific and not vague. :-)

  • Find and Replace

    21
    0 Votes
    21 Posts
    5k Views
    TanquenT

    @peterjones said in Find and Replace:

    you might want to change to [^,\r\n]* for this token to avoid grabbing newlines as well

    Not sure what the issue is. For this file type the template and header rows do not end with a comma. The first field doesn’t start with a comma but that seems to be ok as it sees it correctly as a tag and stops at the first comma. So far, these rows also always end with a comma.

    If two lines where like this and did not end in a comma and ended with a tag:

    DFO_129,S9_Filters,Default,XV_195401,DFO_129 CD_132,S9_Filters,Default,XV_195401,CD_132

    I could maybe endup with this?

    DFO_129CD_132

    I think I’m ok, it seems to work and all the rows with tags end with a comma and if they did not the result would jump out at me, maybe.

    Is there any easy way to stop at the comma but not include it? Seen some examples using Find and Replace to remove an end character but not just in the find expression for marking.

  • NppGtags occur "vector<T> too long" with v8.4 and later

    6
    0 Votes
    6 Posts
    1k Views
    Michael VincentM

    @goldfish-village said in NppGtags occur "vector<T> too long" with v8.4 and later:

    @michael-vincent Thanks, I got response from GitHub

    Great - @pnedev is a very responsive developer, pretty sure there’d be a fix soon, if not one already (which I seems like there was).

    Cheers,

  • How to move text block between two other text blocks?

    5
    0 Votes
    5 Posts
    535 Views
    PeterJonesP

    @hudson4351 ,

    Or alternately, column select, click-and-hold on the upper left b, then drag so the cursor is two spaces after the first bar and then drop: it will be in the new location

  • Layout breaks after a few days

    28
    0 Votes
    28 Posts
    5k Views