Convert tags into anchor tag in jquery

The easy way to convert anchor tag of word of sentence which on start from a specific character or symbol, like social media captions who contains combination of hash tag (start from #),mention user (start from @) and plain text. using Javascript you can convert into each has tag into anchor tag using replace function by specific pattern.

Replace Function

var str="Welcome to Programming Concepts";


Welcome to programming concept


var str = "Welcome to programming concept #programming #concept #php #html #js #android";

 var url = str.replace(/(^|\s)(#[a-z\d-]+g, function (match, capture)
    return '<a href="'+match.replace(" ","")


15 Replies to “Convert tags into anchor tag in jquery”

  1. I simply wanted to type a simple remark in order to say thanks to you for those pleasant information you are giving out at this site. My considerable internet investigation has at the end been compensated with useful suggestions to exchange with my great friends. I would declare that most of us website visitors actually are undoubtedly blessed to dwell in a good site with very many awesome professionals with helpful basics. I feel very much happy to have encountered your entire webpages and look forward to really more awesome minutes reading here. Thanks a lot again for everything.

  2. I just want to tell you that I am just beginner to blogging and site-building and seriously savored you’re web blog. Likely I’m going to bookmark your blog post . You definitely come with impressive posts. Thanks for revealing your web site.

Leave a Reply

Your email address will not be published. Required fields are marked *