• Login
Community
  • Login

Replace bracket

Scheduled Pinned Locked Moved General Discussion
6 Posts 3 Posters 555 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.
  • O
    olek
    last edited by Sep 29, 2024, 7:27 PM

    Hi I would like ask about Replace put some words in the lines .I put on last line some new words but with bracket .The Notepad ++copy me by without bracket .I use $ and mark regular expresion .But replace is without bracket . like this

    AAAAA()(((((Aaaa – replace but I need also bracket .It is any way tell notepad ++ copy replace {}{{ {{(() ) bracket .?

    P 1 Reply Last reply Sep 29, 2024, 8:18 PM Reply Quote 0
    • P
      PeterJones @olek
      last edited by PeterJones Sep 29, 2024, 8:20 PM Sep 29, 2024, 8:18 PM

      @olek ,

      Your question is almost unintelligible.

      If you are in regular expression mode, and you want your REPLACE WITH to output parentheses () , you need to escape them, so if you wanted to output a literal (Text Goes Here), you would have to make REPLACE WITH: \(Text Goes Here\)

      If I have misunderstood your question, see the Useful References below, especially "Template for Search/Replace Questions). And if you want to study Notepad++ regular expressions, start with the “Searching/Regex” in the User Manual.

      If you need more help than that, you’ll have to put more effort into making your question understood.

      ----

      Useful References

      • Please Read Before Posting
      • Template for Search/Replace Questions
      • Formatting Forum Posts
      • Notepad++ Online User Manual: Searching/Regex
      • FAQ: Where to find other regular expressions (regex) documentation
      1 Reply Last reply Reply Quote 2
      • O
        olek
        last edited by Sep 29, 2024, 8:30 PM

        @PeterJones said in Replace bracket:

        (Text Goes Here)

        Sorry for my English

        I have to add something like this at the end of the sentences:\ (hss(ssss(ow()=Ay(),(5)))) replace .but after replace I do not have brackets . how to replace it with brackets .?

        P 1 Reply Last reply Sep 29, 2024, 8:40 PM Reply Quote 0
        • G
          guy038
          last edited by guy038 Sep 29, 2024, 8:43 PM Sep 29, 2024, 8:40 PM

          Hello, @olek, @peterjones and All,

          In addition to the @peterjones’s reply, here are some hints :


          In the zone Replace with, any character represents the character itself EXCEPT FOR :

          • The opening parenthesis which must be written \(

          • The closing parenthesis which must be written \)

          • The anti-slash character which must be written \\


          Depending of the context, the three characters, below, may, sometimes, be escaped in order to be interpreted as literals. These are :

          • The dollar sign

          • The exclamation mark sign

          • The colon punctuation sign


          For example, the regex search/replacement :

          • SEARCH (?-i)^ABC$

          • REPLACE \( {} [] Test \\ $ \))

          would change any line with the uppercase string ABC :

          ABC
          

          by this OUTPUT :

          ( {} [] Test \ $ )
          

          Best Regards,

          guy038

          P.S. :

          I’ve just seen your second post. Thus, from above, in order to get the string \ (hss(ssss(ow()=Ay(),(5)))) in the replace dialog, it should be written :

          REPLACE \\ \(hss\(ssss\(ow\(\)=Ay\(\),\(5\)\)\)\)

          1 Reply Last reply Reply Quote 2
          • P
            PeterJones @olek
            last edited by Sep 29, 2024, 8:40 PM

            @olek ,

            Formatting the post per the advice in the useful references is critical for getting your point across. I’m still not 100% clear on what you want.

            But if what you want in the output is the literal text:

            (hss(ssss(ow()=Ay(),(5))))
            

            Then you would have to escape each of those ( and ) as \( and \), so
            REPLACE WITH = \(hss\(ssss\(ow\(\)=Ay\(\),\(5\)\)\)\)
            Using that in Regular Expression mode will result in

            (hss(ssss(ow()=Ay(),(5))))
            
            O 1 Reply Last reply Sep 29, 2024, 9:07 PM Reply Quote 2
            • O
              olek @PeterJones
              last edited by Sep 29, 2024, 9:07 PM

              @PeterJones need be escape and bracket will be copy complicity.

              REPLACE \ (hss(ssss(ow()=Ay(),(5))))

              Thank you very much.

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