Function to parse phrase/word only regex
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Is there any way to parse out a whole word/phrase only using one of the string functions? For Example, I have text that looks like this
Falls Church VA
Spring Valley Medicine
Now, I would like to match for only VA, not for Valley. I can easily accomplish this using the Find Replace tool by using Match whole word only.
Is it possible to match only VA using regular expressions, or even to utilize a string function such as GetWord to match that exact word/phrase? Is this even possible with the functions provided in Alteryx? Thanks for your help.
Solved! Go to Solution.
- Labels:
- Expression
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If used with case insensitivity will find it.
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Nice one Mark,
@pgensler - here's a slighly different Regex approach:
- http://regex101.com is my best friend - you can easily play here, and learn RegEx the easy way
- (?i)\b(VA)\b is a good regex to only pull whole word VA
- breaking this down:
- (?i) is a command to Regex to be case insensitive
- using parse version of RegEx - whatever is in brackets is kept for you in the output.
- \b is a word boundary
- So in this case - what this says is "keep 'VA' for me if it's between any 2 word boundaries"
This should get you to an answer, and also help your regex exploration :-)
Have a good weekend Peter
Sean
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Could you use the Getword function instead to find the word/phrase VA? I'm just surprised this functionality is not really part of the built in string manipulation functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey Peter,
The Getword function is made to get you word number X. So, for example, if you want word 3, use Getword("this is my string",3) which will return "my".
Did the regex work for you and get you to a solution? Hopefully we can close this out (mark as solved) and get you back on the road again.
Cheers - have a good Monday Peter
Sean
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Get Outlook for iOS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Very glad that this worked.
There's a few threads about functions that people would find helpful under Ideas. Not sure if you are aware but @jdunkerley79 has built a set of add-in functions that you can download, and I've got a request in the ideas queue to include many of these in the core product.
If you want to post this in the ideas section, I'll follow up and vote for it (I agree that this would be useful).
For this thread - would you mind marking it as solved to close it out (just hit the solution button under one of the posts) - that way it can add to the knowledge base, and come up in user searches from within Alteryx.
Thanks Peter - I'll have a look out for your item in Ideas and vote for it when it comes up.
Cheers
Sean
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Sean,
Thanks, I have posted this in the ideas:
Do you know where I can download the functions from @jdunkerley79 ??Are these available on the gallery, or how I can access them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The latest version of @jdunkerley79's formula addins are here:
https://jdunkerley.co.uk/2016/05/15/alteryx-formula-add-ins-v1-1/
and his blog is absolutely excellent - exposes capabilities that most folk are not aware of and makes them very approachable.
Happy hunting Peter
Sean
