I have a java regular expression given by my CS2 instructor that checks if a word is repeated:
\\b(\\w+)\\s+\\1\\b
How can I modify this to check if a word is repeated twice as in "hello hello hello" or "hello world hello hello"
If possible, I'd just like to be pointed in the right direction, not an outright solution (after all, I need to learn this). I think my problem is that I don't understand word boundaries well.
Well, since you seem to want to learn this yourself I'll give you a helpful Oracle Link. And secondly I'll suggest you pay attention to what exactly you're trying to achieve, a pattern with three of the same word. Hope that helps and isn't too obvious. Comment if you need more help.
Edit: Sorry I forgot the second link here. This page is also helpful.