views:

22

answers:

3

I have address data that is surrounded by random text. Is there a way to extract this data either with a call to a web service or some vb.net function?

example: 1111 S WILSON ROAD APT B8 CITY STATE 55555 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

A: 

If your random data is always 0's, try doing a string.Replace to get rid of the 0's and then a Trim() to get rid of extra spaces. You could also use Regex to accomplish the same task to get rid of 0's.

If your random data is truly random, is there a way you can introduce some delimiters in at the beginning and end of your address? For instance, you could have:

#1111 S WILSON ROAD APT B8 CITY STATE 55555# 0 0 0 0 0 0 0 0 0 0 0 0 

This way, you could the SubString function to extract just the data you need using those special characters as delimiters.

-D

Diego C.
A: 

from your example it looks like your data is delimited with 4 numbers in the beginning and 5 numbers in the end so you can use regex as

\d{4}(?<Address>.*)\d{5}

and look for Address group name in match

regexhacks
A: 

Thanks guys for the responses.. I was not fully informed of the test data (.. of course). What I ended up doing was tossing the text over to the Yahoo PlaceFinder API. If it did not return an exact match, I was alert the user and set the address as best I could. Again thanks for your help.

ssparacio