From: "Иван Бишевац" Date: 2012-09-11T22:01:39+09:00 Subject: Re: Parsing through downloaded html --f46d042e0077bcd84c04c96cac1d Content-Type: text/plain; charset=UTF-8 2012/9/11 Sybren Kooistra > Works like a charm :) > > Any idea how I can save boolean (in some cases I do not want the content > of a node, but I only want to know IF a certain word IS or IS NOT part > of the html) > > -- > Posted via http://www.ruby-forum.com/. > > You can use Regex for that. Find some ruby regex tutorial on google. Example tutorial http://www.tutorialspoint.com/ruby/ruby_regular_expressions.htm Here is example code from that tutorial: #!/usr/bin/ruby line1 = "Cats are smarter than dogs"; line2 = "Dogs also like meat"; if ( line1 =~ /Cats(.*)/ ) puts "Line1 starts with Cats" end if ( line2 =~ /Cats(.*)/ ) puts "Line2 starts with Dogs" end --f46d042e0077bcd84c04c96cac1d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
2012/9/11 Sybren Kooistra <= lists@ruby-forum.= com>
Works like a charm :)

Any idea how I can save boolean (in some cases I do not want the content of a node, but I only want to know IF a certain word IS or IS NOT part
of the html)
You can use Regex for that.
Find some ru= by regex tutorial on google.
Example tutorial=C2=A0http://www.tu= torialspoint.com/ruby/ruby_regular_expressions.htm
Here is example code from that tutorial:
#!/usr/bin/r=
uby

line1 =3D "Cats are smarter than dogs";
line2 =3D "Dogs also like meat";

if ( line1 =3D~ /Cats(.*)/ )
  puts "Line1 starts with Cats"
end
if ( line2 =3D~ /Cats(.*)/ )
  puts "Line2 starts with Dogs"
end
--f46d042e0077bcd84c04c96cac1d--