Skip to main content
Solved

ReplaceRegEx failing in AttributeManager

  • March 14, 2019
  • 2 replies
  • 71 views

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

takashi
Celebrity
  • 7843 replies
  • 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
  • 60 replies
  • 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.

Thanks @takashi!

I should have RTFM-ed this ;-)

 

Best,

 

Ed