Skip to main content

Hello there I

I have an attribute with the values like this (24 16 17.2) or this ( 25 7 17.2) we need to replace the first space with a letter A and second space with letter B and add letter W at the end we should get a result like this (24A16B17.2W) and this ( 25A7B17.2W) for the second case

Any idea, please

Thanks

 

Hi @boubcher

I created here a example with your case:

1) Use the AttributeManager to created these two situations of Attributes

2) Split the Attributes and concactenate the values of the lists:

3) Results in FME Data Inspector:

 

Attached the Workspace Workspace_Replacer.fmw

 

Thanks,

Danilo

 

 


I would use the StringReplacer with this setting.

  • Mode: Replace Regular Expression
  • Text to Replace: ^(\\S+)\\s(\\S+)\\s(.+)$
  • Replacement Text: \\1A\\2B\\3W

I would use the StringReplacer with this setting.

  • Mode: Replace Regular Expression
  • Text to Replace: ^(\\S+)\\s(\\S+)\\s(.+)$
  • Replacement Text: \\1A\\2B\\3W

@takashi

Thanks Takashi I am new to those expressions could please let me know how this work and how do you come up with the replacement text format

Thanks again

 


I would use the StringReplacer with this setting.

  • Mode: Replace Regular Expression
  • Text to Replace: ^(\\S+)\\s(\\S+)\\s(.+)$
  • Replacement Text: \\1A\\2B\\3W

There are many resources about Regular Expressions. e.g.


Reply