re = /^(?=.*MVP[^\\]*$)(?!.*Missing[^\\]*$).*\.(?:csv|xlsx?|txt)$/m
str = '\\\\p8files\\MVP\\Inbound\\2023\\202310\\20231016\\BillingProvEntityFix1016.xlsx
\\\\p8files\\MVP\\Inbound\\2023\\202310\\20231016\\BillingProv_MVP_EntityFix1016.xlsx
\\\\p8files\\MVP\\Inbound\\2023\\202310\\20231016\\BillingProv_MVP_Entity_MissingFix1016.xlsx
\\\\p8files\\MVP\\Inbound\\Missing2023\\202310\\20231016\\BillingProv_MVP_Entity_Fix1016.xlsx
'
# 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