From: Konrad Meyer Date: 2007-08-18T08:08:17+09:00 Subject: Re: Return first line of parsing --DSPAM_MULTIPART_EX-1582 Content-Type: multipart/signed; boundary="nextPart13209588.lWzY7ESHj5"; protocol="application/pgp-signature"; micalg=pgp-sha1 --nextPart13209588.lWzY7ESHj5 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Friday 17 August 2007 02:59:39 pm John Joyce wrote: >=20 > On Aug 17, 2007, at 8:59 AM, Tim Pease wrote: >=20 > > On 8/17/07, Haze Noc wrote: > >> mysite.each {|line| > >> if line =3D~ /

(.+)<\/b>/ > >> puts "#{$2} found at: #{$1}" > >> end > >> } > >> > >> Ok guys, Lets say the website has 50+ lines.. and i only want to =20 > >> return > >> the first one, any ideas? > > > > %r/^(.*)$/.match(mysite)[1] > > > Careful, > What if the site's white space has been stripped? (no CR or LF at all) > or if the html/xhtml is screwy? (old html without closed elements, =20 > or just poorly formed or badly nested) The first line of any file doesn't depend on the html in it. His code should return the first line of any file -- html or no. =2D-=20 Konrad Meyer http://konrad.sobertillnoon.com/ --nextPart13209588.lWzY7ESHj5 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBGxipkCHB0oCiR2cwRAt0GAKCCmmALSq0QYEJkjZg2PkVEfU9sswCgwKCc gQrofBrQVZDDF/TqSs6LSqo= =w9Ml -----END PGP SIGNATURE----- --nextPart13209588.lWzY7ESHj5-- --DSPAM_MULTIPART_EX-1582 Content-Type: text/plain X-DSPAM-Signature: 46c62a6715821228095555 !DSPAM:46c62a6715821228095555! --DSPAM_MULTIPART_EX-1582--