Question

Look behind regex in StringSearcher

  • 9 November 2015
  • 4 replies
  • 7 views

Badge
I'm trying to use the following regular expression in StringSearcher (?<=Switch Description ).{5} So for example applied to the following text "Switch Description 1757A" it would find "1757A" However, im getting the following message "couldn't compile regular expression pattern: quantifier operand invalid" Anyone know why this is?

4 replies

Userlevel 2
Badge +17
Hi,

 

 

Some modules of FME including the StringSearcher use Tcl to perform regex operations internally, and Tcl regex engine seems to be one which doesn't support lookbehind unfortunately. See also here.

 

 

Takashi
Badge
Thanks Takashi. I guess i'll have to find the whole string then split it.
Userlevel 2
Badge +17
Yup, if you need to split a text starting with "Switch Description" into the description text and the last 5 characters, this regex would work for the StringSearcher, for example.

 

(Switch Description)\s*(.{5})
Userlevel 4
Badge +13
I can also advise that in FME 2016, all regular expression evaluation is now unified under a new, modern, non-Tcl engine.

Reply