re = /\[ \[SmokeDetector\]\(https:\/\/github\.com\/Charcoal-SE\/SmokeDetector\) \] (.+): \[(.+)\]\(\/\/[\w\.]+.com\/(questions|answers|q|a)\/(\d+)\) by \[(.+)\]\(\/\/[\w.]+\/users\/(\d+)\/[\w+-]+\) on `(.+)`/
str = '[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Link at end of body, pattern-matching website in body, blacklisted user: [ever striking hazard of diabetic foot?](//drupal.stackexchange.com/questions/175521) by [kanjni juriya](//drupal.stackexchange.com/users/52370/kanjni-juriya) on `drupal.stackexchange.com`'
# Print the match result
str.match(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