I am doing string matching with big amount of data.
EDIT: I am matching words contained in a big list with some ontology text files. I take each file from ontology,
I'm not entirely sure if I understood the question correctly, but it sounds like regular expressions would do the job
http://java.sun.com/developer/technicalArticles/releases/1.4regex/