Search code examples
numbersnotepad++moveswapletter

Notepad++ moving letters from the end of text to the begining


i have a text file with values that start a few digits and end with a letter or two at maximum. i need to move those letters to the front.

Original data looks like this: 56465A 498558DF 90255C

and need them to become like: A56465 DF498558 C90255

thank you


Solution

  • Try capturing the leading numbers and trailing uppercase letters in a word, in two separate capture groups. Then, replace with the numbers and letters swapped.

    Find:    \b(\d+)([A-Z]+)\b
    Replace: $2$1
    

    Edit:

    If the group of letters could appear anywhere in the string, then we can use a slightly more complex pattern:

    Find:    \b(\d*)([A-Z]+)(\d*)\b
    Replace: $2$1$3