0

I have a html document and I have to replace all href url with another url using Erlang. I am beginner for erlang. Can any one help me on this?

Ajay V
  • 157
  • 1
  • 3
  • 7

1 Answers1

2

You can use regular expressions for it. There is 're' module in erlang and you can use replace/3

eg.

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

gives you:

"ku[b]a"

http://schemecookbook.org/Erlang/RegexChapter doc for replace/3 http://www.erlang.org/doc/man/re.html#replace-3

I hope this helps.

Jakub Oboza
  • 5,291
  • 1
  • 19
  • 10
  • Thanks Jakub it helped me and got the idea and resolved my problem but...need 1 more help... I have a html content and I have to replace href with my href so I am replacing href=" to href="my url here. SO at the place of & also its replacing href="...Cud u please help me how to escape & in erlang. Thanks – Ajay V Apr 12 '12 at 18:25
  • try using "\&" in your regular expression – Jakub Oboza Apr 14 '12 at 19:07