String regex = "\\bcar\\b"; // 「\bcar\b」 String text = "Madagascar is best seen by car or bike."; Matcher m = Pattern.compile(regex).matcher(text); m.region(7, text.length()); m.find(); System.out.println("Matches starting at character " + m.start()); ----------------------------------------------------------------------------- Copyright 1997-2024 Jeffrey Friedl