/    Sign up×
Community /Pin to ProfileBookmark

I have a paragraph of text and i want to be able to determine what should be a link?

so i was wondering if there is a way to do this?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@cogzidelDec 24.2011 — sure you can do it, go to google and simply copy and paste the paragraph in search box and search, If there is any link which contains that paragraph,you may get the result of link which contains that.
Copy linkTweet thisAlerts:
@JunkMaleDec 24.2011 — Yes and it relies on a keyword list and a URL list a replace function and a bit of effort on your part.

You create an object that is populated with the data paired as {keyword:"url"}

then with a loop, set a pattern to search for and then use the .replace() method in conjunction with the RegExp() search pattern that sets the search pattern and replace the words found in the keyword object with the URL (turn it in to a link) by creating a string that returns HTML that you replace the word with.
×

Success!

Help @moiseszaragoza spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...