<div class="suggesttext tleft">
<a href="#" class="link clearPhoneViews"
data-token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhZElEIjoiNDU4MTI0NjQ2IiwiZXhwIjoxNTQyNDkxMzAxfQ.sJsVtqm9KyUWXlKHmaTtz43rQzWeVH0ZQSpe8NVpj7A"
data-ad-id="458124646">
<span>Обнулить</span>
data-token=\"(.*?)\"\n data-ad-id=\"(.*?)\"
public class Test {
public static void main(String[] args) {
Pattern pattern = Pattern.compile("data-token=\"(.*?)\"\\W+data-ad-id=\"(.*?)\"");
String text = "<div class=\"suggesttext tleft\">\n" +
" <a href=\"#\" class=\"link clearPhoneViews\"\n" +
" data-token=\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhZElEIjoiNDU4MTI0NjQ2IiwiZXhwIjoxNTQyNDkxMzAxfQ.sJsVtqm9KyUWXlKHmaTtz43rQzWeVH0ZQSpe8NVpj7A\"\n" +
" data-ad-id=\"458124646\">\n" +
" <span>Обнулить</span>" +
"<div class=\"suggesttext tleft\">\n" +
" <a href=\"#\" class=\"link clearPhoneViews\"\n" +
" data-token=\"Vtqm9KyUWXlKHmaTtz43rQzWeVH0ZQSpe8NVpj7A\"\n" +
" data-ad-id=\"2\">\n" +
" <span>Обнулить</span>";
Matcher matcher = pattern.matcher(text);
while (matcher.find()){
System.out.println(matcher.group(1));
System.out.println(matcher.group(2));
}
}
}