【发布时间】:2016-02-10 18:28:57
【问题描述】:
我正在 node.js 中为 Discordapp.com 制作一个机器人,它将从 Steam 配置文件的 xml 中提取信息。它从用户消息中获取配置文件链接。
我很难想办法让我的机器人从消息中提取链接,因为它们并不一致。
消息可能如下所示:
http://steamcommunity.com/profiles/76562119803123205611 look at that guys
或
Take a look at this www.steamcommunity.com/id/someusername/
或
look at this steamcommunity.com/profiles/766119803232061 looks cool right?
唯一一致的是“http://steamcommunity.com/”,其他一切都不同。我能否就如何从每条消息中仅提取整个链接而不是其他任何内容获得一些帮助?
【问题讨论】:
-
使用正则表达式 - 见stackoverflow.com/questions/1500260/…
标签: javascript node.js bots steam