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

**URL:** https://meta.discourse.org/t/what-method-is-used-by-discourse-to-identify-urls-in-post-body/75876
**Category:** Development
**Created:** [12 december 2017 om 15:16 UTC](https://meta.discourse.org/t/what-method-is-used-by-discourse-to-identify-urls-in-post-body/75876 "2017-12-12T15:16:44Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [12 december 2017 om 17:16 UTC](https://meta.discourse.org/t/what-method-is-used-by-discourse-to-identify-urls-in-post-body/75876/6 "2017-12-12T17:16:04Z")

</div>

I guess you want to extract all the links inside the post for the feature [Preventing malicious linking - #27 by Sudaraka](https://meta.discourse.org/t/preventing-malicious-linking/37982/27). You can get it simply by `doc.css("a[href]")` using Nokogiri module.

example

> <https://github.com/discourse/discourse/blob/b3b55e18d1c804982eef5a1b4264234e5a5a335f/lib/cooked_post_processor.rb#L154-L155>

---

_[View the full topic](https://meta.discourse.org/t/what-method-is-used-by-discourse-to-identify-urls-in-post-body/75876)._
