Pattern pattern = Pattern.compile("マッチング候補@(.+?)|マッチング候補A(.+?)"); Matcher matcher = pattern.matcher("文字列"); while (matcher.find()) { int count = matcher.groupCount(); : :