Now that it's live, don't forget to accept your certification badge on Credly today! Learn more here.
We are currently experiencing an issue with Email verification at this time and working towards a solution. Should you encounter this issue, please click on the "Send Verification Button" a second time and the request should go through. If the issue still persists for you, please email support@alteryx.com for assistance.

Alteryx Designer Discussions

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

Regex Replace used in formula tool

yvkpatel
6 - Meteoroid

I am trying to replace below strings using Regex:

1) interest payable pursuant to this Section 3(d)(ii) on an Installment Due Date will be $108,452.04.

2) "Fixed Interest Rate" means the annual interest rate of 4.36%.

 

Desired result: $108,452.04      #for 1st line

                        4.36%                #for 2nd line

 

I am using the following methods for the respective lines:

if REGEX_Match([Field],".*fixed interest rate.*") then REGEX_Replace([Field],"(.*?)(\d+.*%)","$1.$2%")

 

if REGEX_Match([Field], ".*interest payable pursuant.*") then REGEX_Replace([Field], "(.*?)(\$\d+.*?)(,\d+.*)", "$1")

 

The result that I get using the above codes are the same previous lines, there is no change.

 

I don't know what I am doing wrong. Can anyone please correct my code?

13 REPLIES 13
estherb47
15 - Aurora
15 - Aurora

Hi @yvkpatel 

 

Would you be able to post the string you're trying to parse with these other formulae? Easier to troubleshoot RegEx if we can see what you're looking at.

 

Cheers,

Esther

estherb47
15 - Aurora
15 - Aurora

Ah, nevermind. I see your statement 🙂

estherb47
15 - Aurora
15 - Aurora

Hi @yvkpatel 

 

When testing your new Regex_Replace on just that string of characters, it works. So, my thought is that within the IF/THEN/ELSEIF, that particular line is matching first to another Regex_Match in a previous ELSEIF.

 

If you change the order of the IFs and ELSEIFs (maybe try putting the latest one first), does it work?

 

Cheers,

Esther

yvkpatel
6 - Meteoroid

I tried changing the order of else if conditional statements and by putting the last one 1st I got the correct answer. So I think as you all said above regarding the problem I was facing it was totally true and Thank You for your kind support with the whole problem.

 

Regards,

Yaksh Patel

Labels