From: hemant Date: 2007-07-23T21:31:41+09:00 Subject: Re: help me.... On 7/23/07, Robert Dober wrote: > On 7/23/07, geetha wrote: > > Hi, > > I am doing string search is one html file usign ruby. > > If the seach sting is htmlentities means I have not match that word. > > How can i do it. Please any one help me..... > > > > regards, > > S.Sangeetha. > > > We might be able to help you better if you post the data and what you > expect to get out from it exactly. > > Robert > > -- Robert: If search string has html entities, then do not proceed with search. Well, its very hard to define if query string has HTML entities or not? For example, do you consider following string has HTML entities? b = "hello world and so what; and < and there we go >" dunno yes and no, but if your answer is yes, and string `b` HAS HTML entities then: require 'cgi' escaped_html = CGI::escapeHTML(b) if escaped_html != b # string contains html entities end if you want a strict validation of HTML tags, and whether query is a valid HTML, then hpricot may help. -- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://blog.gnufied.org