import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "><b>(.*)<\\/b><\\/a><\\/td>";
final String string = "><b>MARTiiNEZ</b></a></td>\n"
+ " <td>30</td>\n"
+ " <td>\n"
+ " El Patrón (6) </td>\n"
+ " <td>\n"
+ " <font color=\"red\">offline</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/124\"><b>Poison</b></a></td>\n"
+ " <td>32</td>\n"
+ " <td>\n"
+ " El dirigente (5) </td>\n"
+ " <td>\n"
+ " <font color=\"red\">offline</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/1333\"><b>KaliboOM</b></a></td>\n"
+ " <td>28</td>\n"
+ " <td>\n"
+ " La Junta del Cartel (4) </td>\n"
+ " <td>\n"
+ " <font color=\"red\">offline</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/5013\"><b>roY.</b></a></td>\n"
+ " <td>19</td>\n"
+ " <td>\n"
+ " La Junta del Cartel (4) </td>\n"
+ " <td>\n"
+ " <font color=\"red\">offline</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/5978\"><b>PYREX</b></a></td>\n"
+ " <td>33</td>\n"
+ " <td>\n"
+ " La Junta del Cartel (4) </td>\n"
+ " <td>\n"
+ " <font color=\"green\">online</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/22462\"><b>BaticZ</b></a></td>\n"
+ " <td>13</td>\n"
+ " <td>\n"
+ " La Junta del Cartel (4) </td>\n"
+ " <td>\n"
+ " <font color=\"red\">offline</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/24019\"><b>FCKYEAAH</b></a></td>\n"
+ " <td>5</td>\n"
+ " <td>\n"
+ " La Junta del Cartel (4) </td>\n"
+ " <td>\n"
+ " <font color=\"red\">offline</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/4559\"><b>Carbon</b></a></td>\n"
+ " <td>20</td>\n"
+ " <td>\n"
+ " El Barón de drogas (3) </td>\n"
+ " <td>\n"
+ " <font color=\"green\">online</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/132\"><b>Costa</b></a></td>\n"
+ " <td>12</td>\n"
+ " <td>\n"
+ " Narco traficante (2) </td>\n"
+ " <td>\n"
+ " <font color=\"red\">offline</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/28512\"><b>diabolo</b></a></td>\n"
+ " <td>5</td>\n"
+ " <td>\n"
+ " Narco traficante (2) </td>\n"
+ " <td>\n"
+ " <font color=\"red\">offline</font> </td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td><a href=\"https://nes-newlife.de/profile/index/28933\"><b>STEVE</b></a></td>";
final Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
final Matcher matcher = pattern.matcher(string);
if (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html