Alteryx Designer Discussions

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

Grabbing first two words regex

hudg16
7 - Meteor

If I have 

SAMSUNG S21+ 128GB

my current regex parse is, (\w+\s+\w+)

How can I make it so I include the "+" so I get SAMSUNG S21+? Currently I get just Samsung S21

Cheers!  

9 REPLIES 9
Qiu
17 - Castor

@hudg16 
How about this one?

1A.PNG

atcodedog05
18 - Pollux

Hi @hudg16 

 

Here is another way to do it.

 

Workflow:

atcodedog05_0-1622785368739.png

 

.+ checks any character set including + and the pattern it checks is 

(.+(character set)\s(spaces)+.+(character set))\s

 

Hope this helps 🙂

mceleavey
16 - Nebula

Hi @hudg16 ,

 

aaaaaaaand another way:

 

(^.*?\s.*?[\w+]+)

 

mceleavey_1-1622795611585.png

 

mceleavey_2-1622795633519.png

 

Regex is my friend.

 

M.

 

 

 

hudg16
7 - Meteor

Thanks everyone, went with mceleavey as it seemed friendliest to some other formatting that could pop up.! 

mceleavey
16 - Nebula

no problem.gif

MarqueeCrew
19 - Altair
19 - Altair

@hudg16 ,

 

Don't do it!!!

 

@mceleavey  and his gang have got you pulling a camper with your tesla (though in the future that might not be a bad option).

 

GetWord([Field1], 0)+" "+GetWord([Field1], 1)

 

GetWord() is the function that you are looking for.  The first word = 0.  This runs in about 2/3 of the time of a RegEx expression.

 

Cheers,

 

Mark

 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Please Subscribe to my youTube channel.
mceleavey
16 - Nebula

Mark just called me and told me off.

It was like being back at school.

 

I'll go away and think about what I've done.

 

sad walk.gif

 

 

atcodedog05
18 - Pollux

Need to find @mceleavey Gifs library

 

giphy.gif

 

mceleavey
16 - Nebula

classified.gif

Labels