Solved

RegEx bug in StringSearcher

  • 16 February 2022
  • 4 replies
  • 7 views

Badge +7

Hi,

I think I found a super obscure bug in StringSearcher. In my workspace I want to use Regex queries based on different conditions, e.g. if a string matches RegEx A use RegEx B in StringSearcher. This logic does work in general but for one specific query I get the Error:

 

"Expression Evaluation Failure: 'This FME edition does not recognize the `' function."

 

Oddly the query works fine when I test it in the RegEx Editor. It also works if I don't use a condition or if I use a different query inside the condition. Is this a bug or am I missing something? Attached an example workspace that illustrates the issue. Thank you for your help!

 

icon

Best answer by chrisatsafe 17 February 2022, 01:06

View original

4 replies

Badge +7

After some trial and error the escaped ")" inside the lookbehind seems to be the culprit: This lookbehind does not work: (?<=\\)), I guess because of the double closed parentheses. When I replace the escaped ")" with another character like a "." it works fine. However this seems to only be an issue in combination with a condition. Would love to know if there is a way to make this work as intended.

Badge +2

After some trial and error the escaped ")" inside the lookbehind seems to be the culprit: This lookbehind does not work: (?<=\)), I guess because of the double closed parentheses. When I replace the escaped ")" with another character like a "." it works fine. However this seems to only be an issue in combination with a condition. Would love to know if there is a way to make this work as intended. 

Interestingly the first time I tried running this in build 22278 (2022 beta) it failed with the same error message. Out of curiosity, I modified the regex from 

(?<=\))(\d|\-|\ )+

 to 

(?<=\))(\d|\-|\s)+

to see if it was just the space that was causing issues. Running with the whitespace character \s seemed to work. 

 

Even more interesting, when I set the Regex back to the original (?<=\))(\d|\-|\ )+ the workspace ran without any issues! After seeing that work, I tried adding a new StringSearcher in 22 and confirmed that it runs the first time with the original conditional statement. So the good news is, this is already fixed! Is running this workspace in FME 22 a suitable workaround for the time being? 

Badge +7

Hi @chrisatsafe​,

thanks for looking into this issue. I still got the same error after updating to the newest version of FME 2021, but upgrading to FME 2022 fixed the issue for me as well. Fortunately I have a floating license so I can use both versions but maybe it would still make sense to create a bug report?

Badge +2

Hi @chrisatsafe​,

thanks for looking into this issue. I still got the same error after updating to the newest version of FME 2021, but upgrading to FME 2022 fixed the issue for me as well. Fortunately I have a floating license so I can use both versions but maybe it would still make sense to create a bug report?

In this case, it doesn't seem like the fix will be backported to 2021 since it's already in the 2022 beta.

Reply