import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "^(?!fashion tv)[^\\n\\r]+\\r?\\nhttps?:\\/\\/[^\\n\\r]+\\r?\\n?";
final String string = "Diva Universal (Россия)\n"
+ "http://буквенно-циферный url\n"
+ "Familia Domashniy\n"
+ "http://буквенно-циферный url\n"
+ "Fashion TV\n"
+ "http://буквенно-циферный url\n"
+ "Fashion TV HD\n"
+ "http://буквенно-циферный url\n"
+ "Fashion TV 3 HD\n"
+ "http://буквенно-циферный url\n"
+ "Fashion TV 9 HD\n"
+ "http://буквенно-циферный url\n"
+ "Fine Living\n"
+ "http://буквенно-циферный url\n"
+ "Fine Living Europe\n"
+ "http://буквенно-циферный url\n"
+ "Fine Living Network\n"
+ "http://буквенно-циферный url\n"
+ "Food Network\n"
+ "http://буквенно-циферный url\n"
+ "Food Network HD\n"
+ "http://буквенно-циферный url";
final String subst = "";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
final Matcher matcher = pattern.matcher(string);
// The substituted value will be contained in the result variable
final String result = matcher.replaceAll(subst);
System.out.println("Substitution result: " + result);
}
}
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