Regex help for SAINT Rule Builder

Avatar

Avatar
Level 1
dabressler
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile

Avatar
Level 1
dabressler
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile
dabressler
Level 1

07-07-2020

Currently have strings coming in with two formats. Some strings end with the character “|” and other strings do not. For example, one value might is “ush|park-map|” and another value is “ush|theme-parks”. The goal is to remove the last pipe “|” from the string IF the string ends with a “|”.

In the SAINT Rule Builder, I was able to remove the last pipe “|” from strings that ended with a pipe “|”. However in the final output, the strings that did NOT end in a pipe had “**Unmatched**” as the final value (1st screenshot below).  The question is how can you return the original/default value if the string doesn’t meet the rule criteria (aka ending with a “|”)?  

 

We'd greatly appreciate your help, thanks!

 

David

Screen Shot 2020-07-07 at 4.32.56 PM.pngScreen Shot 2020-07-07 at 4.33.57 PM.png

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Contributor
MVP
AlexisCazes
MVP

Likes

187 likes

Total Posts

424 posts

Correct reply

198 solutions
Top badges earned
Contributor
Shape 1
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Contributor
MVP
AlexisCazes
MVP

Likes

187 likes

Total Posts

424 posts

Correct reply

198 solutions
Top badges earned
Contributor
Shape 1
Give Back 10
Give Back 5
Give Back 3
View profile
AlexisCazes
MVP

14-07-2020

The correct regex is (.+)(\|)?$

 

Notice the ? at the end of (\|) which stand of zero or one of pipe

Answers (1)

Answers (1)

Avatar

Avatar
Seeker
Moderator
PratheepArunRaj
Moderator

Likes

315 likes

Total Posts

870 posts

Correct reply

264 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Affirm 250
Contributor
View profile

Avatar
Seeker
Moderator
PratheepArunRaj
Moderator

Likes

315 likes

Total Posts

870 posts

Correct reply

264 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Affirm 250
Contributor
View profile
PratheepArunRaj
Moderator

15-07-2020

Dear Dabressler,

You just need to stack the conditions properly. Below you go:

PratheepArunRaj_0-1594800666769.png

And the test results are as below:

PratheepArunRaj_1-1594800803515.png

I Hope, this is what you are expecting.

Thank You, Arun.