Skip to main content
Solved

ReplaceRegEx failing in AttributeManager


Forum|alt.badge.img

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

Best answer by takashi

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.

View original
Did this help you find an answer to your question?

2 replies

takashi
Influencer
  • Best Answer
  • March 14, 2019

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.


Forum|alt.badge.img
  • Author
  • March 14, 2019
takashi wrote:

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


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