Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to parse text from a string that contain special character, text and number

minniiko
5 - Atom

Hi everyone,

 

I'm trying to parse a set of data that has the Account Description in this format:

 

Car Parking Sales (Cash) (105)

Project Expense (External) (104.2)

Transportation - Others (Deployment) (444.95)

 

I want to parse it to separate the text details (including "-") from the number in parenthesis. 

 

Could you please help?

3 REPLIES 3
cmcclellan
14 - Magnetar

There might be a cleaner way, but this works .... 

 

([a-zA-Z\ \(\)\-]*)(\d*\.*\d*)

 

cmcclellan_0-1631234525400.png

 

ncrlelia
11 - Bolide

Hi @minniiko,

 

My suggestion would be (.+)\s\((\d+.*\d+)\)

 

  1. (.+) 
    • .+ = the character before the numbers
    • () helps to identify the value to parse (i.e. output)
  2. \s = the space between the text and numbers
  3. \((\d+.*\d+)\)
    • \d+.*\d+ = numbers in the brackets, including "." if any
    • () identify the value to parse
    • () = to the original brackets for the numbers, added \ to escape the special characters. This is not include within () as we do not want it in the output.

 

ncrlelia_0-1631236112811.png

 

Hope this helps.

 

Cheers,

Lelia

minniiko
5 - Atom

This works like a charm!!! Thank you both so much! Cheers!

Labels
Top Solution Authors