• 0 Votes
    11 Posts
    2k Views
    anontestsA

    @Alan-Kilborn said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:

    Very similar solution. The ^ character represents the start of a line. These are very basic principles in regular expressions.
    So Find What:^-

    There’s a caveat with this one.
    Say the line is like this: -------------I'm a line
    Then a regex operation using ^- would affect ALL of the -, not just the first one.
    HERE is another posting discussing an alternative technique to only handle the first character, when multiple of same are involved.

    Oh.
    Well, to be honest, I actually did want to remove all of them from the 1st and last line, and I think I just did ‘‘replace all’’ over and over again until they were all gone. Haha.
    But, yeah, that’s useful for anyone that specifically needs to remove a certain character from the beginning, but wants to keep the same character.
    Thank you!

  • Macro command reference

    4
    0 Votes
    4 Posts
    4k Views
    PeterJonesP

    @alexolog ,

    See the config files: <Macros> section of the npp-user-manual.org site.

  • Submenu Item on Edit Context Menu

    5
    0 Votes
    5 Posts
    890 Views
    PeterJonesP

    @PeterJones said in Submenu Item on Edit Context Menu:

    in the next release

    Which @donho just released a few mintues ago (thanks!). So now my official docs link points to the explanation with more detail.

  • Regex pattern needed

    3
    0 Votes
    3 Posts
    241 Views
    PeterJonesP

    @PeterJones said in Regex pattern needed:

    Or maybe I will find some time this evening.

    Well, it was the next day, but…

    My mistake in yesterday’s modified BSR = <a[^\s>]*> was including \s in the complement character class, which meant it had to be <a...> without any spaces, which obviously cannot match <a href="...">. Once I realized that, it was easy to fix.

    BSR = <a[^>]*> ESR = </a> FR = %20 RR = \x20 (or literal space) FIND = (?-i:<a[^>]*>|(?!\A)\G)(?s:(?!</a>).)*?\K(?-i:%20) REPLACE = \x20 Final Transformation of my previous data:<a href="https://www.server.example/path/something%20with%20spaces">something with spaces</a> <a href="https://www.different.example/path/one%20space">one space</a> <a href="https://www.third.example/path/spaceless">spaceless</a>
  • Delete an entire line if a specific word is found inside that line

    6
    0 Votes
    6 Posts
    32k Views
    AdrianHHHA

    Thank you @Alan-Kilborn for that explanation. I know and use the dot-matches-newline, and yes I should have specified it in my answer.

  • Replace many lines with conditions

    11
    0 Votes
    11 Posts
    504 Views
    Trần Hoàng LongT

    Thank you @guy038 so much, I used your method and got exact result I want. Great work !

    I’m still trying to understand your method to know more about NPP.

    Thanks again. Have a nice day !

  • UDL Comment Initialization with Whitespace

    2
    0 Votes
    2 Posts
    421 Views
    PeterJonesP

    @John-Smith-3 ,

    UDL is nice, but it cannot handle every possible condition. I don’t think it will do that natively.

    However, you can add extra highlighting to a User Defined Language (UDL) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo – so with installing the PythonScript plugin and using the linked solution, you could define a regex that will color text matching r'c\h+' (raw string, with c followed by horizontal space), or similar, in some way to indicate a cmoment.

  • os.system(<batchfile>) empties copied file

    8
    0 Votes
    8 Posts
    432 Views
    Peter GreistorferP

    @Alan & Peter: I see and understand your view. My low-information policy was based on the wish not to stress you all that much. So well, I’ll poke around and if I find a solution, of course, I’ll post it here.

    Many thanks for your incentives and - not to forget: Happy Easter!

  • Deploy with Command for Translation

    2
    0 Votes
    2 Posts
    213 Views
    EkopalypseE

    @Bernhard-Iceman

    Afaik it is the nativeLang.xml which does get its content replaced with the chosen one.

  • Indent lines missing

    3
    0 Votes
    3 Posts
    312 Views
    Antonio RoscianoA

    Thank you Mr. Alan, I didn’t know.

  • Macro ignores Python script & erratic Shortcut Mapper

    11
    0 Votes
    11 Posts
    440 Views
    Peter GreistorferP

    @Alan-Kilborn Thank you too … now it’s clear ;-)

  • Replace 0 with 0.000

    3
    0 Votes
    3 Posts
    699 Views
    Lakhwinder SinghL

    @PeterJones Thanks, it worked and solved my issue.
    It really saved my time.

  • Page won't load in a browser

    2
    -1 Votes
    2 Posts
    146 Views
    Alan KilbornA

    @Diana

    This forum is about Notepad++, so you’ve asked your question in the wrong place to get help of the type of problem you’ve asked about.

  • How to get correct syntax highlighting for Python 3 formatted strings

    9
    0 Votes
    9 Posts
    1k Views
    J VickroyJ

    @PeterJones
    Thanks again Peter for your followup post with the link on how to repair for non-default themes! This is great and I learned something in the process!

  • 0 Votes
    3 Posts
    348 Views
    EkopalypseE

    @carlos-navarro

    One way to get around this limitation is to use something like my EnhanceAnyLexer.py script.

  • 0 Votes
    7 Posts
    6k Views
    PeterJonesP

    @Vasile-Caraus ,

    Here are some takeaways from this problem. Hopefully, you will remember these, and act accordingly in the future:

    The documentation at https://npp-user-manual.org/docs/searching/ describes all the proper syntax for searching and replacements. In it, you would find the list of \-escapes that are allowed in the REPLACE WITH field (https://npp-user-manual.org/docs/searching/#substitution-escape-sequences). You will notice that the \s and \S are not valid sequences in that field, as @guy038 tried to explain. If you want to search for text that contains spaces, the space character or escape sequence must go in the FIND WHAT, not in the REPLACE WITH The quality of answers you receive is directly proportional to the quality of the question you ask

    Other advice: you have been pointed to the documentation many times over your 5+ years of visiting this forum. You should take advantage of that resource, and read and study that document.

    ----

    Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as literal text using the </> toolbar button or manual Markdown syntax. To make regex in red (and so they keep their special characters like *), use backticks, like `^.*?blah.*?\z`. Screenshots can be pasted from the clipboard to your post using Ctrl+V to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get. Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.

  • Moving Background

    5
    -1 Votes
    5 Posts
    640 Views
    Terry RT

    @Kacper-Kantarowski said in Moving Background:

    I would like to make my background move as the page scrolls.

    @PeterJones @Alan-Kilborn I think he’s actually referring to a webpage, possibly created within NPP and using NPP to open it in his web browser of choice. So he’s asking the question here about html code, how to change his code to fit his need.

    @Kacper-Kantarowski this is a forum about Notepad++, not html coding. You’d be better off asking the coding question in a html forum.

    Terry

  • keep specific urls from text file and delete rest.

    2
    0 Votes
    2 Posts
    127 Views
    Alan KilbornA

    @Ravi-K

    You probably should first refer to previous postings you’ve made here on very similar subjects.

  • 32/64 bit update Notepad++ through Portable app

    2
    0 Votes
    2 Posts
    237 Views
    EkopalypseE

    @Teddy-Quentin-Chung

    How exactly do you install and update PORTABLE npp versions?
    Do you use the ones from PortableApps.com?
    If so, they build the package and you need to ask the question there.

  • How to create syntax highlighting [video tutorial]

    2
    1 Votes
    2 Posts
    391 Views
    EkopalypseE

    @iwanPlays

    If you want to define a themaware UDL, you just have to click with the right mouse button on the color rectangle, so that you see a hatched rectangle.
    To color digits inside {} differently than normal ones
    use delimiters.