The description of what you want isn't very clear. To get better help you should probably also post an example
It sounds like what you're looking for is called Named Entity Recognition. Depending exactly on what you want (and your data) there are existing systems that are very good, but the problem is definitely not solved. If this is what you want, important systems to look at are GATE, Apache OpenNLP and even NLTK.