• Login
Community
  • Login

Notepad ++ place switching

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 226 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.
  • I
    Ilyassb02
    last edited by Feb 22, 2021, 11:22 AM

    Hello im Trying to set custom aliases for a plugin and i encountered this problem:
    i have a custom_aliases.yml file im working on and it goes like this
    BOOKSHELF: Bookshelf
    HAY_BLOCK: HayBale
    HONEY_BLOCK: HoneyBlock
    MAGMA_BLOCK: MagmaBlock
    etc…
    but i want it the other way around like:
    Bookshelf: BOOKSHELF
    HayBale: HAY_BLOCK
    etc…
    doing them manually will take ages since i have about 7000 lines
    i tried to use the search and replace feature but no luck so far

    1 Reply Last reply Reply Quote 0
    • G
      guy038
      last edited by guy038 Feb 22, 2021, 11:40 AM Feb 22, 2021, 11:37 AM

      Hello, @ilyassb02 and All,

      Child’s play with regular expressions !

      • Open your file in N++

      • Open the Replace dialog ( Ctrl + H )

        • SEARCH (?-s)^(.+)(:\x20)(.+)

        • REPLACE \3\2\1

        • If necessary, tick the Wrap around option

        • Select the Regular expression search mode

        • Click on the Replace all button

      Et voilà !

      Notes :

      • We separate the line contents in three groups, with the “colon + space” chars as a pseudo-delimiter

      • In replacement, we rewrite the last part of lines, then the colon + space delimiter and, finally, the first part of lines

      Best regards

      guy038

      I 1 Reply Last reply Feb 22, 2021, 11:56 AM Reply Quote 2
      • I
        Ilyassb02 @guy038
        last edited by Feb 22, 2021, 11:56 AM

        @guy038 thank you man. worked like a charm

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