What method is used by Discourse to identify urls in post body

I guess you want to extract all the links inside the post for the feature Preventing malicious linking - #27 by Sudaraka. You can get it simply by doc.css("a[href]") using Nokogiri module.

example

5 Mi Piace