re = /:\/\/(?!(.+\.)?(meinedomaineins\.de|meinedomainzwei\.de)).+\.php/m
str = 'http://www.fremdedomain.de/index.php soll gefiltert werden
http://www.meinedomaineins.de/index.php soll durchkommen.
http://www.meinedomainzwei.de/index.php soll durchkommen.
<a href="https://www.nochirgendeinedomain.com/site/redirect.php?url=https%3A%2F%2Fwww.irgendeinedomain.com%2Fde%2FFsubmit%2F1%2F&utm_source=DE_BB_2017Q3&utm_medium=email&utm_campaign=allg&utm_content=rebox_ancillary">
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html