Skip to main content
Solved

regex with attributevalidator - highlight "end wih new line"

  • February 21, 2020
  • 5 replies
  • 53 views

ronan
Contributor
Forum|alt.badge.img+6
  • Contributor
  • 25 replies

Hello,

I'm using attributevalidator to make multiple check on attributes.

There is one check I don't know how to implement. I would like to hightlight the attributes finishing with newline. I used this regex : [^(\\n)]$ . It is working when I use external tools (for example (https://regexr.com/ ), but not in FME. I didn't find any other regex to do that (I'm a beginner in regex).

In case, there is one other solution : using tester/attributecreator, but if possible, I would like to gather all the tests in the same transformer to make the workflow as simple as possible (the workflow contains a lot of attribute / spatial tests)

 

Thank you

 

 

Best answer by ebygomm

Try, if you just want to fail strings ending in a newline

[^\n]\z
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.

5 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • February 21, 2020

If you want to find anything where the last character is a newline try

.*\n$

Edit: or are you looking for a statement so that anything ending in a newline comes out the failed port?


ronan
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • 25 replies
  • February 21, 2020

Thank you, but I would like anything ending with a newline comes out the failed port. Then the workbench would provide automatically a report listing the objects that doesn't respect the rules described in the attributevalidator transformer.


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • Best Answer
  • February 21, 2020

Try, if you just want to fail strings ending in a newline

[^\n]\z

ronan
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • 25 replies
  • February 21, 2020

Thanks a lot :-). The following regex you provide me works perfectly !

[^\n]\z

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • February 21, 2020

Thanks a lot :-). The following regex you provide me works perfectly !

[^\n]\z

Matching end of lines and new lines differs depending on the underlying regex flavour, which is why you were getting differing results with external tools. The above for example, wouldn't work if you were trying to use the regex in python.