Question

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

  • 12 April 2022
  • 5 replies
  • 3 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

Userlevel 4

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

 

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.

Userlevel 4

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.

Userlevel 4
Badge +36

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.

Userlevel 5
Badge +29

Can you provide some more examples?

 

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

(\d+) (.*)

 

Reply