Alteryx Designer Desktop Discussions

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

Search String from Right Side

lolwat00000
5 - Atom

Hello, I have a dataset like this, and I need to trim it in the right. The only pattern is that, there will be a bracket in the end.

I used Text to column, but i would like to know if there's a better way, in case there are 3 brackets in the future.

 

StringExtract
abc(999)999
xopo(iioie)dfdfdf(000A)000A
opop-(,mmm)xoxoxo(BBB123)BBB123

 

I am not sure how to use Alteryx to do this... would appreciate help, thanks!

4 REPLIES 4
Raj
15 - Aurora

@lolwat00000 
use this regex formula in formual tool 

REGEX_Replace([String], ".*\(([^()]*)\)[^()]*$", "$1")

find workflow attached for reference
mark done if solved.

Mathias_Nielsen
8 - Asteroid

Hi @lolwat00000,

 

I am no Regex expert by any means, but this got the desired output: \((\w*+\d*)\)$

Insert a regex tool and select parse.

Bobbyt23
11 - Bolide

Regex is great. Here is an option if you wanted to do it as a formula:

 

Substring([String],
//Find start point.
Length([String])-FindString(ReverseString([String]), '(')
//Subtract end point from start point to get length.
,(Length([String])-FindString(ReverseString([String]), ')'))
-
(Length([String])-FindString(ReverseString([String]), '('))
-1)

ChrisTX
15 - Aurora

REGEX_Replace([MyField], ".*\((.*)\)$", "$1")

 

Labels