Skip to main content
Solved

multiple delimiter in AttributeSplitter

  • February 11, 2016
  • 5 replies
  • 173 views

djmcdermott
Contributor
Forum|alt.badge.img+6

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.

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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
Contributor
Forum|alt.badge.img+19
  • Contributor
  • 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
Contributor
Forum|alt.badge.img+19
  • Contributor
  • February 11, 2016
takashi wrote:

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+6
  • 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
Contributor
Forum|alt.badge.img+19
  • Contributor
  • February 12, 2016
djmcdermott wrote:

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


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