Jump to content

Workflow to add colon symbol to string

Recommended Posts


I'm looking on a workflow to copy a specific string (12 character/digits) with no symbols in it, transform it in the same string but adding a colon symbol ( : ) every 2 characters.

Is it possible via workflow or via Text Expander/Replace utility?

I have no clue on how to start! Thank you!

Link to comment
19 hours ago, zeitlings said:

I'm not entirely sure what your desired result looks like. An example would be helpful.

I assume you are looking for this: 

h3llog00dbye -> h3:ll:og:00:db:ye


You can do that with RegEx:


Replacing the captured groups with



You can use the "Replace" utility for that. 



See also: https://regex101.com/r/tZMJDZ/1


Hello! Thank you! Is it possible to filter this for only 12-digits/chars elements in the current clipboard? 

Link to comment

Hey, sure. It is still not clear what you want to do exactly, though.

I assume you are looking for a solution that simply doesn't trigger if the input is not 12 characters long.


Here's a zsh solution you can adjust to your use case:



if [[ $(echo -n $1 | wc -c) -eq 12 ]]; then
	echo -n "$1" | sed -E 's/../&:/g; s/:$//'


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...