Skip to main content

Hi. I need to know how can I get data between two characters.
I have an attribute like this:
10 12 Street (Main) Camnore
Firstly I need to get data between two characters ( ) and Secondly I need to convert it into two columns with this result:
10 12 Street Camnore
10 Main Camnore
Is StringSearcher is helpful? if yes how can I get this result?

I really appreciate your assistance

Hi @marjannikoukar 

 

I suggest you use the transformer StringSearcher with this Regular Expression: (?<=\;).*?(?=\])

 

You get the result into characters.

 

 


Thank you for your reply danilo_fme
When I used that, I got same result as my Input. Do you have any idea?
Thank you for your time

 


Thank you for your reply danilo_fme
When I used that, I got same result as my Input. Do you have any idea?
Thank you for your time

 

Please, could you share your Workspace?


 danilo_fme The result in NotMatched is same as input like this:
10 12 Street (Main) Camnore


Hi, do these RegExes work in your StringSearcher? 

 

(?<=\().*?(?=\)) This matches the word between parentheses (extracts ‘Main’)

\d+ This matches the first number of your string (extracts ‘10)

\w+$ This matches the last word of your string (extracts ‘Camnore’)

 

If you use 3 StringSearchers to extract these strings you can construct “10 Main Comnore” using a StringConcatenator.

You can use a StringReplacer replacing the RegEx \(l^()]+\) to replace the ‘(Main)’ part with nothing, leaving you with “10 12 Street Camnore”

Hope this helps!

 

Edit: I am not familiar with US (?) addresses, so I'm not sure if this matches all your cases


Hi, do these RegExes work in your StringSearcher? 

 

(?<=\().*?(?=\)) This matches the word between parentheses (extracts ‘Main’)

\d+ This matches the first number of your string (extracts ‘10)

\w+$ This matches the last word of your string (extracts ‘Camnore’)

 

If you use 3 StringSearchers to extract these strings you can construct “10 Main Comnore” using a StringConcatenator.

You can use a StringReplacer replacing the RegEx \(l^()]+\) to replace the ‘(Main)’ part with nothing, leaving you with “10 12 Street Camnore”

Hope this helps!

 

Edit: I am not familiar with US (?) addresses, so I'm not sure if this matches all your cases

Hi joepk. Thank you so much for your time and complete answer. I only have a problem.
When I use a StringReplacer replacing the RegEx \(a^()]+\) to replace the ‘(Main)’ part with nothing, it’s not working.  Do you have any idea about it?


 


Yes, your StringReplacer is set to ‘Replace Text’, but you have to set it to ‘Replace Regular Expression’


Reply