Setting up Matcher for String phrase match in file
- by randomCoder
Having trouble figuring out how to match a phrase string to a phrase in file stream. The file I'm dealing with contains random words such as:
3 little pigs built houses and 1 little pig went to the market etc. for many lines
Using "little pig" as my pattern and matcher.find() I can locate 2 matches: "little pig" and "little pigs". However, I only want it to match "little pig".
What can I do? I thought about using matcher.lookingAt() but I wouldn't know how to set a proper region when I can't rely on the file string phrases I'm matching being on separate lines.