Free Trial

Alteryx Designer Desktop Discussions

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

Regex help (start with < and end with :

MK97pro
7 - Meteor

Dear Community,

 

could you please help me with RegEx formula because I cannot find a solution to replace some part of the string:

 

Outer_XML
<jed:Bilans
<jed1:Aktywa
<def:KwotaA
95423752.03</def:KwotaA
<def:KwotaB
73549705.78</def:KwotaB
<jed1:Aktywa_A
<def:KwotaA
28123841.83</def:KwotaA

 

In some places I have string such as "jed:" or "def:" and I want to replace it with nothing to have i.e. <Bilans instead of <jed:Bilans as well ass 95423752.03</KwotaA instead of 95423752.03</def:KwotaA

 

I would be appreciated if you could help!

3 REPLIES 3
AngelosPachis
16 - Nebula

Hi @MK97pro ,

 

You can do that with a formula tool using the following Regex_Replace function:

REGEX_Replace([Outer_XML], "jed:|def:", "")

 

AngelosPachis_0-1640028357200.png

 

Let me know if that works for you,

 

Cheers,

Angelos

Qiu
21 - Polaris
21 - Polaris

@MK97pro 
Regex is sure the elegant one, and let go a bit ugly way 😁
and we dont do anything about "<jed1:Aktywa"?

1221-MK97pro.PNG

apathetichell
19 - Altair

@MK97pro   - use regex_replace([Outer_XML],"^(.*\<)(.*\:)(.*)","$1$3") - that keeps the : and doesn't require def or jed to be in the xml. If you only have jed and def as options - just replace def: and jed: with "" in a regular replace command - otherwise - use my formula.

Labels
Top Solution Authors