Skip to main content
Solved

Regexp match differs


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.*?$
View original
Did this help you find an answer to your question?

3 replies

ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • 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
Evangelist
  • Best Answer
  • October 9, 2018

Hopefully this regex matches each line containing "TWY".

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

Forum|alt.badge.img
  • Author
  • 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.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings