Learning REGEX,, New



  • I never even thought of applying regex to notepad++

    I have a ton that are like

    topic(concentration and something)

    using regex, what is the test way to remote the ( ) completeley…

    Find what zone: (?-i)([a-z]+)([A-Z])
    Replace with zone: ???

    Still learning this. Thanks in advance



  • Could you provide some actual before and after examples. From what you’ve said it’s not readily apparent if you just want to remove the brackets, or the brackets and everything inside of them. Also some conditions such as the brackets start and finish on same line (or maybe across several lines), are there any that have nested brackets, i.e. (cndvjn (njwvjk)).

    These answers will help others to help you.

    Terry



  • In the meantime I’ve cooked up the following regex that might work.

    Assumptions are that there aren’t any nested brackets. The bracket can start on 1 line and finish several lines later, it can even be preceded by some spaces before the starting bracket (which will be removed) and some spaces before the closing bracket.

    Try this, it may work, otherwise provide better examples and someone will surely give you something that works.

    Find: \h*\((.*?\R?)*?\)
    Replace: <empty field>

    Terry



  • @Jeff-Raymond

    Still learning this.

    Please don’t use this forum as a vehicle to LEARN regex. If you have a specific question about an intricacy of regex, and especially one that seems to be acting oddly with Notepad++, then it certainly belongs here, but otherwise there are better places that will be more tolerant of simple regex questions. For sure, read this.



  • Thanks @Terry R

    Example

    Jeff(1234)
    Jeff(JeffIsJeff)
    Jeff(JeffIsntJEff)
    Jeff
    Jeffrey

    I wanted the first three removed. Your example worked.

    And Scott, thanks for the advice. I am a long time user, but I really had no idea how powerful this tool is! I will read your link. Thanks!


Log in to reply