community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

The highly anticipated Alteryx Community tradition is back! We hope you'll join us!

Learn More
We will be upgrading the Gallery to our 2019.4 release this Saturday, December 7th beginning at 9:00am MT. We expect the outage to take last approx. 2.5 hours.
SOLVED

From Right to a specific character

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

 

Alteryx Certified Partner
Alteryx Certified Partner

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. 

Alteryx Certified Partner
Alteryx Certified Partner

Hi @ChrisB 

 

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

 

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

 

ParseMethod.PNG

 

Cheers,

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.  

 

 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Hey @ChrisB  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,

Quasar
Quasar

@ChrisB 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.

Labels