
Hi Hersha,
Thanks for yet another example but I am beginning to realize that I have not fully explained where my problem lie. So let’s try it again:
( i ) I am reading the first primary file line by line. e.g. Employee.dat.
( ii ) While searching for a long list of names on each line, that are getting way too long to be included in the regex such as the following:
String regex = "(\\d)+ (\\w(?:John|Carmen|.....))+ (\\w(?:Smith|Brown|........)) …..
( iii ) Lookup the names in Patient.dat from within regex instead.
( iv ) Return true if these names can be found in Patient.dat.
In other
word, I am matching some patterns between 2 files using regex to determine how many words contribute firstname, and same for surname as well as matching both names and is doing a good job of it. Note that this method is different to the novice approach of direct comparison between the same 2 files. The earlier approach is reading Patient.dat from within regex while the latter is from Java I/O.
Btw, what is the difference between the two examples you have provided? Does Scanner class provide the capability of reading the secondary Patient.dat into the buffer, so that they could be used by regex as lookup, while matching patterns from primary Employee.dat? Likewise, are those 2 files being cached / buffered during pattern matching?
You seem to only show a one dimensional hardcoded regex matching content from a single input file while I am looking for a dynamic regex capable of secondary file lookups (Patient.dat) to match patterns against names in primary (Employee.dat) file.
Have I explained myself clearer this time?
Many thanks for your patience and persistence to help someone in need.
Jack