Skip to main content
Solved

multiple delimiter in AttributeSplitter

  • February 11, 2016
  • 5 replies
  • 239 views

djmcdermott
Contributor
Forum|alt.badge.img+7

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

Best answer by takashi

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 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.

5 replies

takashi
Celebrity
  • Best Answer
  • February 11, 2016

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.


takashi
Celebrity
  • February 11, 2016

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|&|,


djmcdermott
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • February 12, 2016

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 ,


takashi
Celebrity
  • February 12, 2016

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.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • February 12, 2016

it is possible to use wordboundaries.

Tcl flavor in fme uses \\y

so \\yAND\\y