Community
    • Login

    Learning REGEX,, New

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 1.7k Views 3 Watching
    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.
    • Jeff RaymondJ Offline
      Jeff Raymond
      last edited by

      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

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Terry RT Offline
        Terry R
        last edited by

        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
        • Terry RT Offline
          Terry R
          last edited by

          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
          • Scott SumnerS Offline
            Scott Sumner @Jeff Raymond
            last edited by

            @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
            • Jeff RaymondJ Offline
              Jeff Raymond
              last edited by

              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

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors