Replace @mention with link
Replace @mention with link
我希望使用Javascript或jQuery替换<a href="http://twitter.com/mention">@mention</a>
字符串中的任何@提及。我有从第二个答案的功能如何用链接取代普通的url ?我只是想再添加一个replacePattern
function replaceAtMentionsWithLinks ( text ) {
return text.replace(/@([a-z'd_]+)/ig, '<a href="http://twitter.com/$1">@$1</a>');
}
在这里看到它的行动:http://jsfiddle.net/h6HMY/
相关文章:
- Fighting with FRP
- issue with FB.Event.subscribe
- 引导程序:在导航栏中,显示悬停在单个位置的基于Li Link的不同内容
- geolocation-marker.js conflict with markerclusterer.js
- Angular 2.0 with JavaScript or TypeScript?
- 为什么不推荐使用“with”?是否有更好或其他方法可以“下降”到对象的命名空间
- WebComponentsJS with IE10
- 指令的模板必须只有一个根元素:With restrict E&替换true
- LINK rel=子资源用于什么
- timeago.js with datatable and PHP
- Ajax and Json with Rails
- errors with Javascript try catch
- 是否同步加载了LINK元素
- how to split a string with ','
- Understanding Javascript scope with "var that = this&qu
- Architecture for CPU intensive tasks with NodeJS & Socke
- selenium click link href with javascript
- Load HTML with javaScript in <a href...> link
- Creating email link with dynamically generated body with htm
- Replace @mention with link