• Login
Community
  • Login

reorganize numbers/words inside punctuations

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 197 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.
  • H
    Handa Flocka
    last edited by Handa Flocka May 29, 2021, 1:49 PM May 29, 2021, 1:46 PM

    Hi everyone,
    I have a text that is organized like this using punctuation “|” from the closest example:

    hello: one|three|two|four|
    
    *" or sometimes the form comes in numbers, not letters"*
    
    hello: 1|3|2|4|
    
    

    is there a possibility to move words or numbers from the second position to the third or vice versa.
    to became like THIS:

    hello: one|**two**|**three**|four|
    
    *" or sometimes the form comes in numbers, not letters"*
    
    hello: 1|**2**|**3**|4|
    

    I used “**” to mark the changes
    thank you

    1 Reply Last reply Reply Quote 0
    • A
      Abed99
      last edited by May 29, 2021, 3:44 PM

      find : (three|3)\|(two|2)
      replace with : $2|$1
      search mode : regular expression

      1 Reply Last reply Reply Quote 0
      • H
        Handa Flocka
        last edited by Handa Flocka May 29, 2021, 3:50 PM May 29, 2021, 3:48 PM

        Thank you, it has been fixed using some other form, with:

        hello: +(?:\w+\|){N}\K(\w+)\|(\w+)
        

        to replace with

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