Use Java Regex to find multiple matching words in a sentence
问题 I have a sentence, and a set of words say; Mayweather, undefeated … etc. I want to: check if the sentence contains any of the above mentioned words… (I want it to look for matching words only, basically ignore full-stops, commas and new lines.) and if it does, I want to display few words before and after each matching word, maybe by using String.format() Here’s my code which seems to be working OK but not exactly how I want it: String sentence = "Floyd Mayweather Jr is an American