Skip to main content
Solved

Regexp match differs

  • October 9, 2018
  • 3 replies
  • 17 views

Forum|alt.badge.img

Hello all,

I'm using a basic regex to take the lines contains 'TWY' string in StringSearcher Transformer.

The expression returns the expected result when I trying in https://regex101.com/r/mT5rZ3/56here . However, when I try this in the transformer it returns only 1 match.

What am I suppose to do to get every line containing TWY on different match index

Best answer by takashi

Hopefully this regex matches each line containing "TWY".

[^\r\n]*?\bTWY\b.*?$
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.

3 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3429 replies
  • October 9, 2018

I think this expression is difficult as I think by default in fme the dot matches a newline character and the expressions are greedy.

Depending on what your final goal is I'd look at going about this in the other way, e.g. splitting the attribute on the linefeed then testing for the TWY


takashi
Celebrity
  • 7843 replies
  • Best Answer
  • October 9, 2018

Hopefully this regex matches each line containing "TWY".

[^\r\n]*?\bTWY\b.*?$

Forum|alt.badge.img
  • Author
  • 9 replies
  • October 9, 2018

@egomm as you said I guess the dot matches a newline character as well or it has single line flag.

It would be nice to see a documentation of this. Which flags and engine (PRCE probably) does FME using? And is it possible to change the flags?

@takashi that regex worked like a charm!

Thank you both.