Help with Regex Search and Replace



  • Hello! I’m trying to fix and neaten some code and what I’d like to be able to do is a global search and replace which replaces:

    ABC#########WXYZ with ABCWXYZ#########

    There may be between four and nine numbers in the ########## though I don’t mind having to run it once for each possible quantity of numbers.

    ABC WXYZ are all letters and in caps. ABC is the same for each group, but WXYZ can be different.

    the # signs are always representing numbers, and the numbers and letters need to stay the same, just be in a different order.

    Can any expert out there help me with this?

    Thanks!



  • @rderekp

    If I understand correctly you are looking for: (ABC)(\d{4,9})([A-Z]{4})
    and replace with:\1\3\2
    Make sure you have checked regular expression in replace dialog.



  • You are my hero! It looks like this fixed my problem, thank you!


Log in to reply