Alteryx Designer Desktop Discussions

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

From Right to a specific character

ChrisB_dup_72
7 - Meteor

Hi Everyone,

 

I'm having trouble figuring this out.

 

I have a data in this format.  Most of the code is delimited by a period but the last part by a colon. 

NW.SEAS.B154.1.LRC01:AI 1

NW.SEAS.B154.FHC01:AI_7

NW.AL3.256.LR:CTL TEMP

  

I need to take the portion that is to the right from the last period. For example:

From “NW.SEAS.B154.1.LRC01:AI 1”, I need “LRC01:AI 1”

From “NW.SEAS.B154.FHC01:AI_7”, I need “FHC01:AI_7”

From “NW.AL3.256.LR:CTL TEMP”, I need “LR:CTL TEMP”

 

Does anyone know of a tool or formula that will take the characters to the right of a specific delimiter?

Thank you,

Chris

 

5 REPLIES 5
CharlieS
17 - Castor
17 - Castor

Use this expression in a Formula tool where [Input] is the field containing the code values you provided as example.

 

Right([Input],FindString(ReverseString([Input]),"."))

 

This expression works based on the fact that you need the Right side of the string after the last period character. While we don't have a string function for the last character, we do have functions to reverse the characters of a string and then to find the first character. 

Thableaus
17 - Castor
17 - Castor

Hi @ChrisB_dup_72 

 

Using Regex Tool, with Parse Method, you can achieve what you want.

 

.*\.(.*:.*$)

 

ParseMethod.PNG

 

Cheers,

ChrisB_dup_72
7 - Meteor

@CharlieS and @Thableaus 

Thank you for the quick replies.  Both of those are great options.

 

Thableaus - could you please explain the Regex syntax?  I am entirely new to it.  

 

 

Thableaus
17 - Castor
17 - Castor

Hey @ChrisB_dup_72  no problem!

 

.*\.(.*:.*$)

 

Whatever is inside parenthesis is what you want to parse (isolate)

 

.*\. - This part means look for any character 0 or multiple times until you find the last period (\.)

The (.) character is a metacharacter, so you need to escape it to make the reference.

 

The parsing part:

(.*:.*$)

Bring me any character 0 or multiple times until you find a colon (:), then bring me any character after that 0 or multiple times until you find the end of the line ($)

 

There are some details of the RegEX sytnax that you need to get to know better to fully understand why the engine does some things that it does.

 

I recommend this website: https://www.rexegg.com/

 

Cheers,

Treyson
13 - Pulsar
13 - Pulsar

@ChrisB_dup_72 Regex the most intimidating thing that should not be intimidating at all. @Thableaus sent over a great website for explaining what it is. If you want to do some real time testing, check out https://regex101.com/. Here you can paste your sample data in and play around with code and see how it reacts immediately.

Treyson Marks
Senior Analytics Engineer
Labels