Alteryx Designer Desktop Discussions

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

Regex question

Emil_Kos
17 - Castor
17 - Castor

Hi,


I am still learning regex and I would kindly ask the community for help.

 

Can someone provide me with information on how wright regex that will remove | (vertical dash) as the last sign?

 

Usually I have more then one so it should remove one or more of them but only if vertically dash is the last character.

 

 

Input

ABC|||||

Expected output:
ABC

 

I also have 

ABC|ABD||||

 

Expected output:

ABC|ABD

 

I hope that makes sense 🙂 

15 REPLIES 15
danilang
19 - Altair
19 - Altair

Hi @Emil_Kos 

 

Regex isn't the only way to deal with strings.  Try

 

 

TrimRight([Field1],"|")

 

 

Simple and elegant

 

Dan

Emil_Kos
17 - Castor
17 - Castor

Hi @danilang,

 

This time I wanted to go for something so much complicated when so simple solution was available.

 

@afv2688 Thank you. You nailed it as well! This time it worked perfectly! 

mpennington
11 - Bolide

@danilang 

I'm planning on giving a presentation at our local user group about RegEx versus alternatives and this is exactly the kind of thing I am trying to focus on. I have fallen in love with Regular Expressions, but I always want to use the best tool for the job. Great stuff, love it.

Michael

Emil_Kos
17 - Castor
17 - Castor

Hi @mpennington,

This sounds really interesting. If I could also participate in it please keep me in mind 😁

mpennington
11 - Bolide

@Emil_Kos 

Absolutely. I am one of the leaders of the Kansas City User Group and I will be happy to follow up once we get it on the calendar. My expectation is that it will be between the 7th and 10th of April, but not positive. Virtual meeting, so happy to welcome all who are interested. 

Michael

Emil_Kos
17 - Castor
17 - Castor

Hi @mpennington,


I joined the Kansas city user group to get notification about the event 😀

Labels
Top Solution Authors