import java.util.regex.*; class Test{ public static void main (String[] args) throws java.lang.Exception { String s = "both 56% as well as 30-60%."; Pattern pattern = Pattern.compile("\\b(?:\\d+[—–-])?\\d+(?:%|percent\\b)"); Matcher matcher = pattern.matcher(s); while (matcher.find()){ System.out.println(matcher.group()); } }}