re = /^(?!QCNIL|Epic_SNA).+$/m
str = 'Epic_IKDH_Appt_Phone_Reminders_20191030.txt
Epic_NAMMI_Appt_Phone_Reminders_20191031.txt
QCNIL-Recall_Phone_Reminders_20191029.txt
Epic_SNA_Appt_No_Show_Reminders_20191029.txt
Epic_IKDH_Appt_Phone_Reminders_20191030.txt
Epic_NAMMI_Appt_Phone_Reminders_20191031.txt
QCNIA-Recall_Phone_Reminders_20191029.txt
Epic_SNB_Appt_No_Show_Reminders_20191029.txt'
# 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