Splitting Addresses in to Individual Fields

I have a process that needs to identify a record based on their current address. I am trying to find an easy way to parse an address string into its individual components. For example:

123 MAIN ST

For this example, it is clear you could just split on a space and have what I need. However, let’s say I have this:

123 N MAIN ST APT 2103

For this, I would need the address split like this:

123, N MAIN, ST APT 2103 (this is just how our query system needs it)

How would I go about doing this easily? I assume I would need some mechanism that knows all of the street types and somehow split by that, but can’t figure out how to implement it.

@Tyler294 There should be a Definite pattern to make this work. Like the number of words for each of the Splitted address should be fixed. If not there should be an anchor to indicate the last address starts from this Anchor, Or the First Split should have only Numbers. If there’s no definite pattern, I’m not sure if we can do it.

2 Likes

Would there not be any way to see if the address contains one of the predetermined street types and split there? I.e. if the address contains " RD " then split there, or " AVE "?

@Tyler294 Yes that is possible, considering you have list of Street types already present in a list to compare.