Skip to main content
Question

attribute timmer question


hi all 

 

 

I have an sttribute that holds streetnames "A4(Bradfield Hwy)" . 

 

 

I'd like to trim it to read just "Bradfield Hwy" . 

 

 

The string replacer works to replace the brackets . but the attribute trimmer didnt work to remove "A4"

 

 

Any help is appreciated .

 

 

Thank you !

6 replies

takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • April 8, 2015
Hi,

 

 

Did you try setting "A4" to the "Trim Characters" parameter?

 

 

Alternatively, the StringReplacer with this setting can also be used to extract the string within brackets.

 

Text to Match: .+\\((.+)\\)

 

Replacement Text: \\1

 

Use Regular Expressions: yes

 

 

Takashi

 


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • April 8, 2015
The AttributeTrimmer cannot be used in the case where trim characters cannot be specified.

 

If the number of trim characters is fixed, you can use the SubstringExtractor.

 

Otherwise, consider using the StringReplacer  with a regular expression. I have already posted a regex example. See my first post.

  • Author
  • April 14, 2015
hi takashi

 

 

i tried using just the String replacer as suggested with

 

 

Text to Match: .+\\((.+)\\)

 

Replacement Text: \\1

 

Use Regular Expressions: yes

 

 

but it didnt work . am I missing something

 

 

please let me know

 

 

Thanks

 

 

 

takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • April 14, 2015
I believe the StringReplacer with the regex works to extract the target string surrounded by brackets from source string written in the format "prefix(target string)", e.g. "A4(Bradfield Hwy)".

 

Could you please check the format of source string?

takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • April 14, 2015
And also make sure that the regex ".+\\((.+)\\)" doesn't contain extra whitespaces.

  • Author
  • April 15, 2015
hi takashi

 

 

it worked like magic !!!!! made sure there were no spaces

 

 

Thank you so  much for your help !!!!

 

 

 

 

 

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