This page is outdated

You are reading documentation for Linkify v2. Browse the latest v3+ documentation.

Jump To

Core Linkify



var linkify = require('linkifyjs');


<script src="linkify.amd.js"></script>
  require(['linkify'], function (linkify) {
    // …

Browser globals

<script src="linkify.js"></script>


linkify.find (str [, type])

Finds all links in the given string


  • String str Search string
  • String [type] only find links of the given type

Returns Array List of links where each element is a hash with properties type, value, and href:

  • type is the type of entity found. Possible values are
    • 'url'
    • 'email'
    • 'hashtag' (with Hashtag plugin)
    • 'mention' (with Mention plugin)
  • value is the original entity substring.
  • href should be the value of this link’s href attribute.
linkify.find('For help with, please email');

Returns the array

    type: 'url',
    value: '',
    href: '',
    type: 'email',
    value: '',
    href: ''

linkify.test (str [, type])

Is the given string a link? Not to be used for strict validation - See Caveats


  • String str Test string
  • String [type] returns true only if the link is of the given type (see linkify.find),

Returns Boolean

linkify.test(''); // true
linkify.test('', 'email'); // false

linkify.tokenize (str)

Internal method used to perform lexicographical analysis on the given string and output the resulting token array.


  • String str

Returns Array