Created
September 27, 2023 08:04
-
-
Save reachkamrul/f00bc52a87b2758dc9480467b5a650a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery('.foo-table tr td').each(function(){ | |
// Get the content | |
var str = jQuery(this).html(); | |
// Set the regex string with the modified pattern | |
var regex = /(https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/\-_\.]*(\?\S+)?)?)?)/ig; | |
// Replace plain text links by hyperlinks | |
var replaced_text = str.replace(regex, "<a href='$1' target='_blank'>$1</a>"); | |
// Echo link | |
jQuery(this).html(replaced_text); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment