Solved

ReplaceRegEx failing in AttributeManager

  • 14 March 2019
  • 2 replies
  • 18 views

Badge

Hi all,

I'm trying to clean latlongs using RegEx in the AttributeManager but I'm getting below error.

 

AttributeManager_2: Expected signature @ReplaceRegEx(UTF8,UTF8,UTF8,[BOOL]) but received ReplaceRegEx("latitude" content="52.132932,("latitude" content=)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Feature Type: `AttributeManager_OUTPUT'

Attribute(encoded: UTF-8): `LAT' has value `"latitude" content="52.132932'

Attribute(string) : `fme_feature_type' has value `Creator'

Attribute(string) : `fme_geometry' has value `fme_undefined'

Attribute(string) : `fme_type' has value `fme_no_geom'

Coordinate System: `'

Geometry Type: IFMENull

===========================================================================

AttributeManager_2 (AttrSetFactory): An error occurred while evaluating the above expression. If the failed expression is arithmetic, check to ensure there is a numeric value specified as the substitution value for null, empty and missing attributes.

AttributeManager_2 (AttrSetFactory): AttributeManager_2: Failed to evaluate input expression: @ReplaceRegEx(@Value(LAT),"("latitude" content=")(\\d*\\.\\d*)",\\2)

 

 

Settings and example workbench:

LAT attribute with this value:

 

"latitude" content="52.132932

AttributeManager setting:

 

@ReplaceRegEx(@Value(LAT),"("latitude" content=")(\\d*\\.\\d*)",\\2)

 

 

Thanks,

 

Ed
icon

Best answer by takashi 14 March 2019, 08:33

View original

2 replies

Userlevel 2
Badge +17

Hi @edhere, try escaping the inside double quotations with back slash.

@ReplaceRegEx(@Value(LAT),"(\"latitude\" content=\")(\d*\.\d*)",\2)

FME String functions require escaping double quotations if they are within a string parameter surrounded by double quotations. See here to learn more: String Functions

I would recommend you to use the StringReplacer in this case.

Badge

Hi @edhere, try escaping the inside double quotations with back slash.

@ReplaceRegEx(@Value(LAT),"(\"latitude\" content=\")(\d*\.\d*)",\2)

FME String functions require escaping double quotations if they are within a string parameter surrounded by double quotations. See here to learn more: String Functions

I would recommend you to use the StringReplacer in this case.

Thanks @takashi!

I should have RTFM-ed this ;-)

 

Best,

 

Ed

Reply