try this -
String str="#important thing in #any programming #7 #& ";
Pattern MY_PATTERN = Pattern.compile("#(\\S+)");
Matcher mat = MY_PATTERN.matcher(str);
List strs=new ArrayList();
while (mat.find()) {
//System.out.println(mat.group(1));
strs.add(mat.group(1));
}
out put -
important
any
7
&