Skip to main content

Hi all,

I'm trying to remove some unwanted data using StringReplacer.

 

I'd like to remove all data contained within brackets and also remove the brackets themselves.

What I have:

Alblasserdam (A15 Sliedrecht – Ridderkerk)

 

Bospoort (A4 Schiphol - Den Haag)

 

What I want:

 

Alblasserdam

 

Bospoort

 

 

Can I use StringReplacer for this?

Thanks,

Ed

Hi @edttom, yes, I think the StringReplacer with this setting does the trick.

  • Text to Find: \\s*\\(.*?\\)
  • Replacement Text: <not set>
  • Use Regular Expressions: yes

Many thanks for the fast response @takashi , it worked!

 

However, I'm curious as to what "\\s*\\(.*?\\)" does. Can you clarify or point me to some documentation explaining this query?

Thanks


Many thanks for the fast response @takashi , it worked!

 

However, I'm curious as to what "\\s*\\(.*?\\)" does. Can you clarify or point me to some documentation explaining this query?

Thanks

The help doc on the StringSearcher and the StringRepalcer contains short description about regular expressions. Then, see also these links to learn more.

 


Many thanks for the fast response @takashi , it worked!

 

However, I'm curious as to what "\\s*\\(.*?\\)" does. Can you clarify or point me to some documentation explaining this query?

Thanks

Addition.

 

  • \\s* 0 or more whitespaces
  • \\( an opening round bracket
  • .*? 0 or more any characters (? indicates that "matches the minimum length" in this case)
  • \\) a closing round bracket

Many thanks for the fast response @takashi , it worked!

 

However, I'm curious as to what "\\s*\\(.*?\\)" does. Can you clarify or point me to some documentation explaining this query?

Thanks

Takashi gave you most elegant solution.

 

It is Regular Expresion.

 

Watch how it works e.g. at http://rubular.com/ or directly in FME when open properties of 'Text to Match' if 'Use Regular Expression' is maked to 'yes'

 

 


Reply