Not sure how much it helps, but Realex has something kind of similar here: https://github.com/Shopify/active_merchant/blob/master/lib/active_merchant/billing/gateways/realex.rb#L246-L249

Seems like we have to just make a best effort if the gateway's just punting on it. Then if merchants complain about AVS checks failing when they shouldn't, there would be specific examples that could inform tweaks to the extraction algorithm.