In automator there is an action called "Extract Data from text". It can extract stuff like email addresses, phone numbers but also addresses. How does that work? How does automator know that the text that it is receiving is an address?
OS X features NSDataDetector which has the ability to detect types of data.
More information regarding the NSDataDetector class can be found on Apple's developer site: