Dingding Ye
1/3/2008 10:37:00 AM
[Note: parts of this message were removed to make it a legal post.]
You should also process the \n, \r char.
So I think the regex should be "<!--(.|\n|\r)*?-->".
On Jan 3, 2008 11:37 AM, Jim Clark <diegoslice@gmail.com> wrote:
> Try this...
>
> C:\temp>irb
> irb(main):001:0> mystring = "xxx<!-- and end with --> yy <!-- another
> comment --> zz"
> => "xxx<!-- and end with --> yy <!-- another comment --> zz"
> irb(main):002:0> mystring.gsub(/<!--.*?-->/,'')
> => "xxx yy zz"
>
> Regards,
> Jim
>
> K. R. wrote:
> > hi @all
> >
> > I would like to parse html code and remove all tags that starts with
> > <!-- and end with -->
> >
> > How can I remove this tags with regex? I used the gsub! function to
> > manipulate the string.
> >
> > Thanks for helping...
> >
>
>
>