Skip to main content
Question

Run each record of a string attribute through a list of REGEX until an attribute has a value

  • April 12, 2022
  • 5 replies
  • 32 views

Hi people,

 

I have a list of addresses which needs to be split from 'Street+BuildingNumber ' to 'Street' and 'BuildingNumber'.

 

Desired output 

I have a file with REGEX that might work on these addresses, so running each REGEX one by one (in top-down order) against my addresses will eventually split the address into Street and BuildingNumber.

Once this is achieve, it goes to the next record and try to split it with those REGEX.

 

Is there a way to achieve this?

 

As it is a lot, I don't want to use SQLCreator and put every REGEX in there.

 

Looking forward for any light at the end of the tunnel...

5 replies

david_r
Celebrity
  • 8391 replies
  • April 12, 2022

If the addresses are always on this format, the least technical solution could be use an AttributeSplitter set to <space> and assume that the first part is the building number, and the remaining parts are the street name (concatenate with a space).

 


  • Author
  • 1 reply
  • April 12, 2022

Hi @david_r​ , unfortunately the addresses are not always in the same pattern, this is why I need the REGEX pattern to be applied. But thanks for your comment.


david_r
Celebrity
  • 8391 replies
  • April 12, 2022

Hi @david_r​ , unfortunately the addresses are not always in the same pattern, this is why I need the REGEX pattern to be applied. But thanks for your comment.

In that case we need examples of all the different patterns that may occur, otherwise it's almost impossible to suggest something that'll work for all cases.


geomancer
Evangelist
Forum|alt.badge.img+58
  • Evangelist
  • 932 replies
  • April 12, 2022

You may be able to define your REGEX rules (or the logic behind those rules) in the Conditional Value function of an AttributeManager or an AttributeCreator.


hkingsbury
Celebrity
Forum|alt.badge.img+63
  • Celebrity
  • 1625 replies
  • April 13, 2022

Can you provide some more examples?

 

For the Vernon road example you can use the follow in a StringSearcher

(\d+) (.*)