Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
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
21 - Polaris
21 - Polaris

@hudg16 
How about this one?

1A.PNG

atcodedog05
22 - Nova
22 - Nova

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
17 - Castor
17 - Castor

Hi @hudg16 ,

 

aaaaaaaand another way:

 

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

 

mceleavey_1-1622795611585.png

 

mceleavey_2-1622795633519.png

 

Regex is my friend.

 

M.

 

 

 



Bulien

hudg16
7 - Meteor

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

mceleavey
17 - Castor
17 - Castor

no problem.gif



Bulien

MarqueeCrew
20 - Arcturus
20 - Arcturus

@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 restart. Order shall return.
Please Subscribe to my youTube channel.
mceleavey
17 - Castor
17 - Castor

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

 

 



Bulien

atcodedog05
22 - Nova
22 - Nova

Need to find @mceleavey Gifs library

 

giphy.gif

 

mceleavey
17 - Castor
17 - Castor

classified.gif



Bulien

Labels