Solved

multiple delimiter in AttributeSplitter

  • 11 February 2016
  • 5 replies
  • 34 views

Badge +5

Good day FME'ers,

I have a field containing string values which I would like to split on multiple characters. Each string contains one of more of "and", "&" and "," e.g. WORKSHOP AND PREMISES or SHOP, OFFICE AND PREMISES.

Is there a way to specify multiple characters in the delimiter or string row? The option for conditional values would be ideal here.

Thanks

icon

Best answer by takashi 11 February 2016, 17:19

View original

5 replies

Userlevel 2
Badge +17

Hi, firstly replace all the possible delimiters with an identical delimiter string (e.g. "__delim__") using the StringReplacer.

  • Text to Match: AND|&|,
  • Replacement Text: __delim__
  • Use Regular Expressions: yes

You can then use the AttributeSplitter to split the resulting string using "__delim__" as delimiter string.

Userlevel 2
Badge +17

Hi, firstly replace all the possible delimiters with an identical delimiter string (e.g. "__delim__") using the StringReplacer.

  • Text to Match: AND|&|,
  • Replacement Text: __delim__
  • Use Regular Expressions: yes

You can then use the AttributeSplitter to split the resulting string using "__delim__" as delimiter string.

This regex may be better.

\\sAND\\s|&|,

Badge +5

Thanks Takashi, Works a treat. It would still be nice to have this option in a single transformer though. Perhaps a list of values to separate on or a conditional using regex. E.g. IF \\d\\s ELSE ,

Userlevel 2
Badge +17

Thanks Takashi, Works a treat. It would still be nice to have this option in a single transformer though. Perhaps a list of values to separate on or a conditional using regex. E.g. IF \\d\\s ELSE ,

@djmcdermott, in fact, I published a transformer named "RegxAttributeSplitter". Find it in your Transformer Gallery: FME Store/Pragmatica folder.
Badge +3

it is possible to use wordboundaries.

Tcl flavor in fme uses \\y

so \\yAND\\y

Reply