Skip to main content
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 !
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

 


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

 

 

 
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?
And also make sure that the regex ".+\\((.+)\\)" doesn't contain extra whitespaces.
hi takashi

 

 

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

 

 

Thank you so  much for your help !!!!

 

 

 

 

 

Reply