Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Matching Text between Brackets in Consecutive Records

alexg1
8 - Asteroid

Hello all,

 

I am trying to determine if two consecutive records in a table match. They may be variable length, and they may differ, BUT the ones I need to match start with bracketed text and everything between those brackets should be standardized. For example my records would look like this:

 

[John] Snow
[Tyrion] Smith
[Tyrion] Lannister
[Ned] Jones
[Ned] Stark
Robert

Robert

I tried using the following RegEx, but I kept getting a malformed function call:

 

IF REGEX_Match([Row-1:NAME], \[.*?\]) = REGEX_Match([NAME], \[.*?\])

THEN 1

ELSE 0

ENDIF

 

The result I am trying to produce would look like this:

 

 

[John] Snow          

0

[Tyrion] Smith

0

[Tyrion] Lannister

1

[Ned] Jones

0

[Ned] Stark

1

Robert

 

0
Robert0

 

Any assistance is appreciated.

2 REPLIES 2
CharlieS
17 - Castor
17 - Castor

First and foremost, great example data. In your posted expression, don't forget that the RegEx expressions need to be in quotes when using that function:

 

REGEX_Match([Row-1:NAME],"\[.*?\]")

 

Otherwise, I was able to achieve the desired output using substring( functions. Here's the formula I used:

 

IF findstring([NAME],"[")!=-1 AND
substring([NAME],findstring([NAME],"[")+1,findstring([NAME],"]")-1)==substring([Row-1:NAME],findstring([Row-1:NAME],"[")+1,findstring([Row-1:NAME],"]")-1)
THEN 1
ELSE 0 ENDIF

alexg1
8 - Asteroid

Thank you! This was a big help!

Labels