Regexp

Hi,

I’d like to get all the keywords in a html page defined like this one:

In this example, kewords are "wallpaper, sex, kostenlose, high quality, desktop"

The pb is when there are more than one
in the page.
How can i get all ?

With Perl, something like
while (/regexp/g) {
#do smt with $1
}
works.

How can I do that with Ruby ?

Regards.

With Perl, something like
while (/regexp/g) {
#do smt with $1
}
works.

How can I do that with Ruby ?

Maybe with
string.scan(/regexp/) { |match|
# do something with match
}
.

keyWords = {}

completeHtmlPage.scan( /<meta\s+name=“keywords”\s+content="([^"]+)"/i ) do

m>
$1.strip.split( /\s*,\s*/ ).each |kw|
keyWords[ kw ] = true
end
end

keyWords.keys.sort do |kw|
puts kw
end

or so

robert

“Cedric Foll” cedric.foll@ac-rouen.fr schrieb im Newsbeitrag
news:pan.2003.04.29.14.41.01.599662@ac-rouen.fr

Hi,

I’d like to get all the keywords in a html page defined like this one:


in the page.
How can i get all ?

With Perl, something like
while (/regexp/g) {
#do smt with $1
}
works.

How can I do that with Ruby ?

Regards.