Consider the following:
Address 1: 12 ST. JOHN DRIVE
Thorofare: ST JOHN DRIVE
I need to perform some REGEX to match these two addresses, as you can see the main differences between them are:
1.) The road name has been written in the house name/number field
2.) There is a DOT after the word ST in the wrong address.
I have a list of CORRECT addresses which match the WRONG address in question's postcode. From this list I want to filter it down to the correct 1 address.
This is what I have so far:
Addresses.FirstOrDefault(x => x.paon.Trim() == Regex.Replace(exception.AddressLineOne, "[^0-9.]", "") && x.thorofare.Trim() == Regex.Replace(exception.AddressLineOne, "[^\\d-]", ""));
What I'm trying to do is firstly remove everything that is not a number from the WRONG address 1 and match it with the CORRECT
saon, then remove everything that is a number from the WRONG address 1 and also, whilst I'm at it replace any
with an empty string, and then match that with the CORRECT
I think I have done the first part in my code, but cant see how to also remove the dot and replace it with an empty string?
So, how do I, using regex, remove all numeric's from
exception.AddressLineOne and also replace the dots with nothing?