From: hemant Date: 2007-07-23T21:50:54+09:00 Subject: Re: help me.... On 7/23/07, hemant wrote: > 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. > > Some tips on asking questions: 1. Have a meaningful subject or else your question will look like spam. 2. Also please respond to answers that people are posting in response to your question. 3. Robert suggestions. -- 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