• Login
Community
  • Login

Learning REGEX,, New

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 3 Posters 1.4k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    Jeff Raymond
    last edited by Jul 14, 2018, 2:15 AM

    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

    S 1 Reply Last reply Jul 14, 2018, 11:54 AM Reply Quote 0
    • T
      Terry R
      last edited by Jul 14, 2018, 2:56 AM

      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

      1 Reply Last reply Reply Quote 0
      • T
        Terry R
        last edited by Jul 14, 2018, 3:26 AM

        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

        1 Reply Last reply Reply Quote 1
        • S
          Scott Sumner @Jeff Raymond
          last edited by Jul 14, 2018, 11:54 AM

          @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 .

          1 Reply Last reply Reply Quote 0
          • J
            Jeff Raymond
            last edited by Jul 14, 2018, 3:14 PM

            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!

            1 Reply Last reply Reply Quote 1
            2 out of 5
            • First post
              2/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors