Removing docker Image tag id from image names

I have list of docker image names like below

aa-bb-cc-2.10.0-14
aa-bc-cd-ef-ghi-2.10.0-410

I want this to be replaced as

aa-bb-cc:2.10.0-14
aa-bc-cd-ef-ghi:2.10.0-410

There are a lot of such docker images names where I want to remove the docker image tag from the complete name. How can I replace all at a single go. Any script or formatting in Notepad++. Can anyone help with this.

Thanks.


Solution 1:

  • Ctrl+H
  • Find what: (?<=[a-z])-(?=\d)
  • Replace with: :
  • CHECK Wrap around
  • CHECK Regular expression
  • Replace all

Explanation:

(?<=[a-z])      # positive lookbehind, make sure we have a letter before
-               # hyphen
(?=\d)          # positive lookahead, make sure we have a digit after

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here