Giter Site home page Giter Site logo

Comments (7)

alankilborn avatar alankilborn commented on May 28, 2024 1

I want to add a prefix -= and suffix =- to each multi-selected words

As N++ doesn't support multiselected text as the result of a search, the way to achieve something like that is doing a replace instead, where you add in the -= / =- (or whatever) delimiters as part of the Replace with text expression.

from notepad-plus-plus.

molsonkiko avatar molsonkiko commented on May 28, 2024

Before claiming that any regex implementation lacks the capability to do X, you should learn about the capabilities of the regex engine and fully articulate what you want, including examples of things that should and should not match your regex.

Until you provide some examples, nobody is going to be inclined to give you any assistance beyond recommending that you read the documentation.

from notepad-plus-plus.

alankilborn avatar alankilborn commented on May 28, 2024

Until you provide some examples

...which would have taken care of itself if @alienfxfiend had submitted an issue using the issue template.

Suggest closing this issue until such is provided.

from notepad-plus-plus.

alienfxfiend avatar alienfxfiend commented on May 28, 2024

Oh sorry, I cannot use this RegEx select: (http://[^\s]+) to Replace links into this (add wrapping Angle Brackets surrounding it): <$1> (it only selects the first occurrence, (& I remember reading about how NPP does not support this kind of multi-selects (I think, in an AI model prompt)).)

from notepad-plus-plus.

molsonkiko avatar molsonkiko commented on May 28, 2024

@alienfxfiend

Don't ask large language models (LLMs) about Notepad++. They will mostly tell you lies. This is because there just isn't enough true information about Notepad++ in their training data.

I would also discourage using LLMs for regex. There are better sources; I think StackOverflow is better. It is still useful to learn how regular expressions work, so that if you find a regular expression that doesn't work for you, you can modify it to make it work better. In your example, (http://[^\s]+) only matches URLs with the http protocol, whereas you probably want to match the https protocol as well.

In any case, a quick DuckDuckGo search for url match regex turned up this StackOverflow post, from which I got a regular expression that I modified slightly to (?-i)https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)

Also, you don't need to wrap the regular expression in grouping parentheses in Notepad++. If you want to wrap some text in (), you can just regex-replace some text with (${0}), because Notepad++ supports backreferences to the entire captured string as ${0}.

from notepad-plus-plus.

alienfxfiend avatar alienfxfiend commented on May 28, 2024

Apologies, I was addressing the wrong issue. So I have a list of words & I want to add a prefix -= and suffix =- to each multi-selected words, but the "In Selection" in the "Replace" dialog grays out the option. The result is every word in the current document gets the delimiters -= & =- .I need NPP to allow me to add prefix -= & suffix =- to multiple selections of words among a text. I used this RegEx: \b(\w+)\b & replaced with: -=$1=- .This is why I said NPP doesn't have this functionality. Links can be wrapped in Angle-Brackets but multiple words among many cannot using RegEx ! Please try to fix this in the future. For example:
These words:

  1. Agitated 2. Curmudgeon 3. Plankton
    I select Curmudgeon & Plankton (Ctrl+double-click both) then Ctrl+H Replace dialog, the "In Selection" is grayed out. I need to be able to apply multiple-wrapped-prefix\suffix to words to only multiple dispersed selected words —should look like this:
  2. Agitated 2. -=Curmudgeon=- 3. -=Plankton=-
    But the whole document's words are replaced. If there's another RegEx to do this let me know (this is the limitation the AI was speaking of.)
    P.S: More importantly, there's no way to apply this RegEx if it's more than one word!!!
    P.P.S: The problem appears to be I cannot apply a phrase to wrap (.*) and then use the same Replace RegEx on a word \b(\w+)\b Could this be fixed?

from notepad-plus-plus.

alienfxfiend avatar alienfxfiend commented on May 28, 2024

O.K. I got it all sorted, thank you. Sorry for the bewildering lengthy posts /w so many issues being listed. In the end, Notepad++ has a robust solution to these problems !

from notepad-plus-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.