Calling all Racers for the Alteryx Grand Prix! It's time to rev your engines and race to the stage at Inspire! Sign up here.

Alteryx Designer Discussions

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

regex_match with ()

8 - Asteroid

in a formula tool, I have this:


if REGEX_Match([nameplate],'C-MAX|Focus|FocusRS|MKZ|Taurus') then 0 else [Wheelbase] endif


but if in the [nameplate] field, there is Focus (NA) and it's getting ignored in this formula tool.  I've tried the following and none of it works:


Focus (NA)

"Focus (NA)"

`Focus (NA)`

'Focus (NA)'



How do i convince regex_match to match on something with a space and ()?  thanks






12 - Quasar

Hi becki,


Theres a couple of ways to approach this. If you waont to capture all things that have "Focus" followed by any number of characters, you could use:


if REGEX_Match([nameplate],'C-MAX|Focus\s.*|FocusRS|MKZ|Taurus') then 0 else [Wheelbase] endif


The "\s" indicates that there should be one whitespace in that location. The "." character says: "any type of character", and the "*" says, 0 or more of the previous character.


Let me know if this isn't working.




12 - Quasar

Hi @becki


The issue with the brackets are that these are metacharachters. This means that they have a special meaning in Regex. To get around this you need to escape them - this turns them back into their literal character - i.e. a bracket instead of a start to a group. The way to escape something is to put a \ in front of it.


Here is an example for yours. The \s represents a space.




Hope that helps!


8 - Asteroid

perfect, thanks!

8 - Asteroid

thanks.  that worked too!

8 - Asteroid

Hi Guys,

This was very helpful, thanks for sharing. However, I'm kind of stuck on the next step. I'm trying to select multiple strings in a column which have (). 


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\)') I'm trying to use this formula to filter these strings but it isn't working. Is there any other way I can do this?

8 - Asteroid

If I have not understood you wrong, use below in a formula tool against the field and verify.

Create a Boolean field and test the inputs.

True is 1 False is 0


IF REGEX_Match([Security Type], "American Depository Receipt\s\(ADR\)") THEN 1
ELSEIF REGEX_Match([Security Type], "Corporate Bond") THEN 1
ELSEIF REGEX_Match([Security Type], "Government Bond") THEN 1
ELSEIF REGEX_Match([Security Type], "Global Depository Receipt\s\(GDR\)") THEN 1