Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript link detector

function URLReplacer(str){
        let match = str.match(/((https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig);
        let final=str;
        match.map(url=>{
            final=final.replace(url,"<a href=""+url+"" target="_BLANK">"+url+"</a>")
        })
        return final;
      }
Comment

PREVIOUS NEXT
Code Example
Javascript :: airbnb react native eslint 
Javascript :: javascript Using Math.max() on an Array 
Javascript :: react createelement 
Javascript :: remove node from linked list c 
Javascript :: npm module 
Javascript :: reducer react 
Javascript :: add select option jquery 
Javascript :: javascript object/function which you want to proxy 
Javascript :: vanilla tilt js 
Javascript :: react navigation header title 
Javascript :: enhanced object literals in es6 
Javascript :: js code for webpage download progress bar 
Javascript :: can we add string and int in javascript 
Javascript :: javascript if return true false 
Javascript :: AJAX - The XMLHttpRequest Object 
Javascript :: loop through an array 
Javascript :: check the type of a variable in js 
Javascript :: node.js global variables 
Javascript :: chrome-aws-lambda 
Javascript :: javascript regular expression end of string 
Javascript :: for ... of ... 
Javascript :: how to create a variable in javascript 
Javascript :: Angular passing function as component input 
Javascript :: react router native back button 
Javascript :: object 
Javascript :: vue js props 
Javascript :: how we can set react select required 
Javascript :: javascript syntax of throw statement 
Javascript :: jquery get element attribute 
Javascript :: find last item in an array JS 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =