Skip to main content
Question

Using Regex within AttributeValidator to match anything but X string

  • August 7, 2018
  • 4 replies
  • 271 views

Forum|alt.badge.img

I am sure this is a simple fix for this, but I've been testing this for hours now and going nowhere!

In AttributeValidator, I want to FAIL an attribute which contains a certain string. The most logical thing I could think of is to use the Contains Regex validation rule. Let's say I want to 'Fail' every attribute where it contains a string which = FME. I have trawled the internet and got the following expression to work within the Regex Editor:

\\b(?!FME)\\b\\S+

However, when it runs in the AttributeValidator, attributes which i have engineered to contain FME, appears from the Passed output port.

1. Is there a much simpler way within the AttributeValidator to fail any attribute which contains a certain string, rather than regex?

2. If not, am I doing something fundamentally wrong with the Regex or validation rule?

Thanks

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.

4 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3430 replies
  • August 7, 2018

[^fme] should work for everything except fme

Edit: although it doesn't appear to....


Forum|alt.badge.img
  • Author
  • 16 replies
  • August 7, 2018

[^fme] should work for everything except fme

Edit: although it doesn't appear to....

Thanks, @egomm that works! However, what I should have put in the question above was that there could be other string in the attribute, e.g, MEF and [^fme] would include this as well. What i need is a string only match and it looks like that is a character match?

 


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3430 replies
  • August 7, 2018
Thanks, @egomm that works! However, what I should have put in the question above was that there could be other string in the attribute, e.g, MEF and [^fme] would include this as well. What i need is a string only match and it looks like that is a character match?

 

Try ^(?!.*fme).*$

 

 


takashi
Celebrity
  • 7843 replies
  • August 7, 2018
Thanks, @egomm that works! However, what I should have put in the question above was that there could be other string in the attribute, e.g, MEF and [^fme] would include this as well. What i need is a string only match and it looks like that is a character match?

 

Additionally, if word boundaries are required before and after 'FME', try this one.

 

^(?!.*\bFME\b).*$