Urya Posted July 1 Share Posted July 1 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
vitor Posted July 1 Share Posted July 1 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
Urya Posted July 1 Author Share Posted July 1 Thanks so much, @vitor, that works perfectly! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now