We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Regex issue

Carlyn
8 - Asteroid

Hi

Can anyone help me with this Regex formula I am trying to build? I think the & sign in group 4 is throwing out the formula as it is working for strings that don't have any special characters.

 

/[^0]*(\d{1,2}\/\d{1,2}\/\d{4})\s*(\D*)(\d{2}\s\D*)\s+([A-Z]{2,4}\D*)\s+([A-Z0-9]{2,4}\D*)(\d+\.?\d{0,2}?)\D+(\d+\.?\d{0,2})\D+(\d+\.?\d{0,2})\D+(\d+\.?\d{0,2})
/gm

 

07/22/2025 TEST TEST LLC 45 Loss Expenses D&O Directors & Officers Z0 Unknown or Unclassified 0.00 0.00 0 10.02

 

The output I am looking for is:

 

GROUP 107/22/2025
GROUP 2TEST TEST LLC
GROUP 345 Loss Expenses
GROUP 4D&O Directors & Officers
GROUP 5Z0 Unknown or Unclassified
GROUP 60.00
GROUP 70.00
GROUP 80
GROUP 910.02

 

Can anyone suggest how to amend it

3 REPLIES 3
Ladarthure
14 - Magnetar
14 - Magnetar

Hi @Carlyn,

 

I built a regex that may suit your need, but with only one row of data it makes a bit hard to make it generic enough, here are some elements though :
^(\d{2}\/\d{2}\/\d{4})\s+(.*?)\s+(\d+\s+.+)\s+(D&O Directors & Officers)\s+(Z\d+.+)\s+(\d+\.?\d{0,2})\s+(\d+\.?\d{0,2})\s+(\d+\.?\d{0,2})\s+(\d+\.?\d{0,2})$

a few notes : I use /s for a space as a delimiter between groups

 

group text part regex notes regarding the regex
GROUP 1 07/22/2025 (\d{2}\/\d{2}\/\d{4})  
GROUP 2 TEST TEST LLC (.*?)  
GROUP 3 45 Loss Expenses (\d+\s+.+)  
GROUP 4 D&O Directors & Officers (D&O Directors & Officers) this I could not generalize
GROUP 5 Z0 Unknown or Unclassified (Z\d+.+) I used Z but if it is an upper letter followed by a sumber could be \u\d+
GROUP 6 0.00 (\d+\.?\d{0,2})  
GROUP 7 0.00 (\d+\.?\d{0,2})  
GROUP 8 0 (\d+\.?\d{0,2})  
GROUP 9 10.02 (\d+\.?\d{0,2})  

 

also, I always recommend trying to use websites like regex101 to test your regex, it helps you identify which part is causing troubles !

 

I hope it helps !

flying008
15 - Aurora

Hi, @Carlyn 

 

Parse by RegEx:

 

(\d{1,2}\/\d{1,2}\/\d{4})\s*(\D*)(\d{2}(?:\s[[:alpha:]]+)+)\s+([A-Z&]{2,4}\D*)\s+([[:alnum:]]{2,4}\D*)(\d+\.?\d{0,2})\D+(\d+\.?\d{0,2})\D+(\d+\.?\d{0,2})\D+(\d+\.?\d{0,2})

 

录制_2025_09_16_14_42_02_446.gif

 

NameValue
Txt07/22/2025 TEST TEST LLC 45 Loss Expenses D&O Directors & Officers Z0 Unknown or Unclassified 0.00 0.00 0 10.02
RegExOut107/22/2025
RegExOut2TEST TEST LLC 
RegExOut345 Loss Expenses
RegExOut4D&O Directors & Officers
RegExOut5Z0 Unknown or Unclassified 
RegExOut60.00
RegExOut70.00
RegExOut80
RegExOut9

10.02

dreldrel
8 - Asteroid

The simplest approach may be to separate the elements with a delimiter rather than using regex, which would ensure you get the right elements if they change the patterns

Labels
Top Solution Authors