我想在字符串中提取与“@”对应的单词并将其保存在列表中:
例如:
"This is @crazy_boy crazy" should give ["crazy_boy"]
"This is @crazy_boy crazy @foobar" should give ["crazy_boy","foobar"]
"This statement is boring" should give [] //or whatever is an empty list
在蟒蛇
targets = re.findall(r'(?<=@)\w+', text)
以上用于解决问题..但我在java中不太确定。谢谢