Alteryx Designer Desktop Discussions

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

Regex_Match with multiple strings and ()

vvissamsetty
8 - Asteroid

Hi Guys,

I'm trying to filter the following strings from a column by using REGEX_MATCH. The issue here is few of them have '()' and I tried using the following formula but it doesn't seem to be working

 

American Depository Receipt (ADR)

Corporate Bond

Government Bond

Global Depository Receipt (GDR)

 

REGEX_Match([Security Type], 'American Depository Receipt\s\(ADR\)\Corporate Bond/Government Bond\Global Depository Receipt\s\(GDR\)')

 

Is there any other way I can do this?

4 REPLIES 4
Thableaus
17 - Castor
17 - Castor

Hi @vvissamsetty 


Regards to your REGEX, the alternation character is "|" and not "\"

 

REGEX_Match([Security Type], 'American Depository Receipt\s\(ADR\)|Corporate Bond|Government Bond|Global Depository Receipt\s\(GDR\)')

 

Still I think you could use a Contains Function which would work better than a REGEX in terms of performance.


Cheers,

Claje
14 - Magnetar

Hi,

 

Just wanted to chime in with one more recommendation - if you're looking for a series of different terms, and only those specific terms, the Find Replace Tool is great for this, since you can easily configure it to scale better, where a Contains() format (or a RegEx) might become very difficult to read if you had more than 3 or 4 search terms.

 

You can configure Find Replace to Append fields when it finds a match, and then filter out any case where there is or is not a match using that new column.

 

From a pure speed perspective, it may be slower than a Formula or a RegEx (although not by much), but it is a lot more maintainable in my opinion.

vvissamsetty
8 - Asteroid

Thanks @Thableaus. For some reason Contains wasn't working and I came across Regex in few discussions as an alternative.

vvissamsetty
8 - Asteroid

Thanks @Claje . I will keep this in mind.

Labels