Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get twitter username from string javascript

function HandleToUrl(text){
    var urlRegex = /([@]).*/g;
    return text.replace(urlRegex, function (name) {
        console.log(name)
        return '<a class="text-blurple" target="_blank" href="https://twitter.com/' + name + '">' + name + '</a>';
    })
}
 
PREVIOUS NEXT
Tagged: #twitter #username #string #javascript
ADD COMMENT
Topic
Name
2+3 =