Jump to content

How to add a symbol every few characters in a query?


Recommended Posts

I'm hoping to make a workflow that turns a query that looks like '12345678' into '1234-5678', adding a line break every four characters in a query. I'm guessing this can be done in regex, but I'm not too familiar with how to do that. Would anyone be able to help me figure it out?

 

Thanks!

Link to comment

Welcome @Urya,

 

Indeed you can do it with a regex. Use the Replace Utility to replace (.{4}(?!$)) with $1-. It might look complicated, but the heart of it is the (.{4}) which means “capture four characters in a row”. The cryptic (?!$) adds to that, saying “except if they’re right at the end”. This is to avoid 12345678 becoming 1234-5678-.

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...