Skip to main content
Question

How to remove many blank spaces in a field so only one blank space remains?


Forum|alt.badge.img

Dear FME community,

I have an attribute which has many blank spaces in the middle. I want to reduce the amount of blank spaces to only one single space (character). I'm not very fit in regular expression, so I'm hoping somebody can tell me the code for the StringReplacer. Many thanks!

Kind regards

Thomas

3 replies

erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • March 30, 2016

I managed to do this using a sequence of 2 StringReplacer transformers:

The first using regular expressions replacing \\s* by #, the second not using regular expressions replacing ## by a white space.


Forum|alt.badge.img

Hi @thomask

one more option is a single StringReplacer with regular expression. The StringReplacer parameters should be:

  • Text to Match: [<space>]+
  • Replacement Text: <space>
  • Use Regular Expressions: yes

deanhowell
Influencer
Forum|alt.badge.img+23
  • Influencer
  • May 17, 2019

Just a slight update based on FME 2019


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