【问题标题】:How to replace href url with other url in html document using erlang?如何使用erlang将href url替换为html文档中的其他url?
【发布时间】:2012-04-23 19:23:42
【问题描述】:

我有一个 html 文档,我必须使用 Erlang 将所有 href url 替换为另一个 url。我是erlang的初学者。谁能帮我解决这个问题?

【问题讨论】:

  • 我试图在谷歌上搜索,但到目前为止我什么也没找到......
  • 我的意思是向我们展示您目前拥有的代码,其中有一个需要帮助的漏洞..

标签: html url replace erlang href


【解决方案1】:

您可以使用正则表达式。 erlang中有're'模块,你可以使用replace/3

例如。

re:replace("kuba","b","[&]",[{return,list}]).

给你:

"ku[b]a"

http://schemecookbook.org/Erlang/RegexChapter 替换文档/3 http://www.erlang.org/doc/man/re.html#replace-3

我希望这会有所帮助。

【讨论】:

  • 感谢 Jakub,它帮助了我并得到了想法并解决了我的问题,但是......需要更多帮助......我有一个 html 内容,我必须用我的 href 替换 href 所以我正在替换href=" 到 href="我的网址。所以在 & 的地方也是它的替换 href="...Cud u 请帮助我如何在 erlang 中逃脱 &。谢谢
  • 尝试在正则表达式中使用“\&”
猜你喜欢
  • 2022-01-20
  • 1970-01-01
  • 2011-10-24
  • 2012-01-02
  • 2013-01-29
  • 2013-02-10
  • 2018-08-31
  • 2011-07-17
  • 2021-03-24
相关资源
最近更新 更多