import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "[[Video:(http)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?4";
final String string = " <p class=\"arttxt_tit\">ARTBLOG YAZARIMIZ OLUN! ekavArtblog</p>\n"
+ " <p class=\"arttxt\"><i>22.11.2011</i></p>\n"
+ " <p class=\"arttxt\">\n"
+ " <p style=\"text-align: center;\">\n"
+ " <br />\n"
+ " <img alt=\"\" src=\"http://www.ekavart.tv/handlers/Image.ashx?id=984\" style=\"width: 364px; height: 272px;\" /><br />\n"
+ " <br />\n"
+ " <br />\n"
+ " Sanatla ilgili her türlü yazınısı bizle paylaşın, yayınlayalım.<br />\n"
+ " <br />\n"
+ " Yazılarınızı, iletişim bilgilerinizle beraber info@ekavart.tv adresine en az 5 görselle gönderebilirsiniz.</p>\n"
+ "[[Video:http://data.ekavart.tv/ekav/temp/mp4/2016/7/13/3061.mp4\n"
+ " </p>\n";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
while (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