re = /structure|(constant\s+?maturity\s+?|CMS|CMT)|inverse\s+?floater|snow\w+|steepener|flattener|(digital|callable|accrual|CRANS)|(variance|volatility)|quanto|trigger/mi
str = '• Anything with “Structured Note”
• Anything with “Constant Maturity swap” or “CMS” (i.e., “CMS” or “CMS option”)
• Anything with “Constant Maturity Treasuries” or “CMT” (i.e., “CMT swaps or CMT swaptions”)
• Anything with “Inverse floater” inverse floater
• Anything with “Snowball”
• Anything with “Steepener”
• Anything with “Flattener”
• Anything with “Digital and Callable Range Accrual Notes” (“CRANS”)
• Anything with “Variance” or “Volatility” in connection with “swap”
• Anything describing a “Quanto” swap or swaption
• Anything describing a “Trigger” swap or swaption
'
# 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