开发者

Address data extraction from text via asp.net (vb.net)

I have address data that is surrounded by random text. Is there a way to extract this data either wit开发者_StackOverflowh 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


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


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜