UNPKG

@redsift/text-utilities

Version:

Tiny library wrapping text processing code snippets.

6 lines (4 loc) 177 B
'use strict'; export default function replaceURLsinText(text, fn) { return text.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, fn); }