Alteryx Designer Desktop Discussions

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

Need help in Regex_Replace formula not Regex tool

RajatRehria
8 - Asteroid

Hi Guys, I hope u all doing well.

 

I have a text as |Dividend income|66|25|78|1,256|361 and I want how can i get the values till second pipe from the end using Regex_Replace formula only (not via Regex tool),

required output is |1,256|361 please help with the Regex formula. Thanks.

10 REPLIES 10
alexnajm
17 - Castor
17 - Castor

Done based on the requirements above!

 

REGEX_Replace([Data], ".*(\|.+\|.+)", "$1")

ShankerV
17 - Castor

Hi @RajatRehria 

 

One way of doing this.

 

REGEX_Replace([Field1], "(.+)(\|.+\|.+)","$2")

 

ShankerV_0-1680717676556.png

 

Many thanks

Shanker V

 

RajatRehria
8 - Asteroid

Many thanks to both of you guys, it worked. Can u please help me in one more thing that how can I learn the RegEx the way you guys are expert, any book, cheat sheet, or article where i can learn from very basic to advanced then please let me know. Many thanks again.

alexnajm
17 - Castor
17 - Castor

I recommend practicing through regex101: build, test, and debug regex!

ShankerV
17 - Castor

Hi @RajatRehria 

 

@alexnajm suggestion is the best which I will also suggest too. In additional, you can also make use of the below.

 

https://www.youtube.com/watch?v=Mxx0Or8oBYc

 

Many thanks

Shanker V

RajatRehria
8 - Asteroid

Thanks again :)

Meggan
6 - Meteoroid

what if I want to pull everything to the right of the first space

FRLP72S 12
IHLE41AL 144
SFLM54AB 60

desired output from the above

12

144

60

alexnajm
17 - Castor
17 - Castor

@Meggan RegEx_Replace([Field], ".+\s(\d+)", "$1")

Meggan
6 - Meteoroid

@alexnajm  worked beautifully - thank you!

Labels