Skip to main content
Question

String Replacer with Conditional Value

  • October 24, 2017
  • 2 replies
  • 260 views

pflegpet
Contributor
Forum|alt.badge.img+8

Hi! I'm trying to create a conditional value for a StringReplacer but I don't get it to work. Basically I have an attribute that can contain substrings starting with a space followed by a slash (e.g. "keep / remove"). In such cases I want to remove everything after "keep" exept for one special case where I want to keep the whole string (e.g. "keep / keepalso"). I tried doing so by setting up conditional values for the "text to replace" parameter with this logic:

IF attribute contains "/"

 

AND Attribute != "keep / keepalso"

 

Output = regex _/.*$,

 

ELSE Output = <empty>

 

 

In other words the StringReplacer should either replace the regex with an empty string (exept for "keep / keepalso") or do nothing.

 

It seems to work for replacing all " / remove" substrings but also overwrites all other instances with empty values.

 

 

Is it even possible to do what I want to do with one StringReplacer? Thank you for your help.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3434 replies
  • October 24, 2017

This works for me


pflegpet
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • 62 replies
  • October 24, 2017

This works for me

Thanks, now it works for me too. I had set the value for non-matches to "empty string" instead of "do nothing". Must have happened when I tried different settings on the transformer. I would not have guessed that this actually works despite the red background on the output value.