Alteryx Designer Desktop Discussions

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

RegEx match help

Frndly
6 - Meteoroid

Hello, I'm trying to match an amount from the text with newlines, amount has leading currency symbol, so I'm trying to match based on that(in the string there are no other currency symbols. Example below.

" · CAD –> Main · EUR
      €1 046.72"

" · CAD –> Main · USD
      $1 533.18"

These are already simplified strings(right side that contains the amounts). This formatting is not universal. The only universal thing is that it's on the rightmost side of the string(before the newline or before end of the string)

Now for the frustrating part, this is the pattern that I'm using (([€\$]\s*)?\d{1,3}(?: \d{3})*(?:\.\d{2})\s*). I've tried adjusting it many times, and it shows in regex debugger(regex101) that it should catch those amounts just fine, but it doesn't catch in the alteryx(I'm using regex match function for it). Am I missing something? Is there an error in the pattern?

3 REPLIES 3
Pilsner
11 - Bolide

Hello @Frndly 

I've tried to tackle this problem using character sets. ([£€$][0-9\s\.]+)

This first looks for any character out of [£€$], and then it finds every occurrence of a number, space or decimal [0-9\s\.]+ after the initial currency symbol. By using the parse function in the regex tool, it should extract this value out.

Screenshot 2025-03-25 095220.png


Please let me know how you get on.

Regards - Pilsner

 

GMG0241
7 - Meteor

I think the issue is that you're not telling Alteryx to include the leading stuff in the match. In layman's terms, by adding "[\s\S]*?" to the front of your REGEX to get the new REGEX:   [\s\S]*?(([€\$]\s*)?\d{1,3}(?: \d{3})*(?:\.\d{2})\s*) tells Alteryx that it's ok to have stuff in front of the match. For example, if my regex string was \d+ and I had the string "aa2", I normally wouldn't want that to match, whereas if I say [\s\S]*?\d+ then I'm telling the regex that it's ok to match the stuff in front.

Frndly
6 - Meteoroid

Thank you! This actually was the reason why regex match didn't work

Labels
Top Solution Authors