Notepad ++ place switching

  • 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
    but i want it the other way around like:
    Bookshelf: BOOKSHELF
    HayBale: HAY_BLOCK
    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

  • 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 thank you man. worked like a charm

Log in to reply