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!
-
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!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login