Start Free Trial

Alteryx Designer Desktop Discussions

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

RegEx - Number between ()

sahartz
8 - Asteroid

Hi,

 

I have these expressions: 

Level 11 (0.90%) 

Level 1 (2%)

 

and I want only the number 0.90 and 2

Can you assist?

 

Thanks :)

4 REPLIES 4
DataNath
17 - Castor
17 - Castor

\((.*)%

 

Should do the trick!

IraWatt
17 - Castor
17 - Castor

Hey @sahartz,

I agree with @DataNath\((.*)% should do the trick!

IraWatt_0-1652017568107.png

essentially the \ at the beginning acts as an escape character for the ( meaning that the ( acts as a normal character not as a marked group. Then the (.*) is your market group. So the statement essentially says any characters between a ( and a % sign. regex101: build, test, and debug regex is a great website for learning and searching for common regex. 

HTH,

Ira

binu_acs
21 - Polaris

@sahartz one way of doing this

 

REGEX_Replace([Input], '.*\((.*)%.+', '$1')

 

binuacs_0-1652017966914.png

 

apathetichell
20 - Arcturus

regex_replace([Input],".*\((\d*\.*\d*).*\).*","$1",0)

 

there are lot of unknowns from your description - so some of the other solutions might not work. Depending upon how your full dataset is formatted all or none of these solutions might work.

Labels
Top Solution Authors