buggy
09-02-2004, 05:16 AM
I have taken in a web page and I would like to extract all data that appear betweeen >< (names etc). No comma, quotes, colons etc just text. I have removed spaces also.
I am using the following code with no success:
if (($filestring) = ($filestring =~ /(\>\w+\<)/)) {
$comp_string = $filestring;
open(fileout,">> NOutput.txt") or dienice("Couldn't open Output.txt for writing: $!");
flock(fileout,2);
seek(fileout,0,2);
print fileout $comp_string,"\n";
close(fileout);
$filestring = substr($filestring, index($filestring,($filestring =~ /(\>\w+\<)/))+6, length($filestring))
}
while(($filestring) = ($filestring =~ /(\>\w+\<)/))
{
$comp_string = $filestring;
open(fileout,">> NOutput.txt") or dienice("Couldn't open Output.txt for writing: $!");
flock(fileout,2);
seek(fileout,0,2);
print fileout $comp_string,"\n";
close(fileout);
$filestring = substr($filestring, index($filestring,($filestring =~ /(\>\w+\<)/))+6, length($filestring))
}
Any help would be great!!
I am using the following code with no success:
if (($filestring) = ($filestring =~ /(\>\w+\<)/)) {
$comp_string = $filestring;
open(fileout,">> NOutput.txt") or dienice("Couldn't open Output.txt for writing: $!");
flock(fileout,2);
seek(fileout,0,2);
print fileout $comp_string,"\n";
close(fileout);
$filestring = substr($filestring, index($filestring,($filestring =~ /(\>\w+\<)/))+6, length($filestring))
}
while(($filestring) = ($filestring =~ /(\>\w+\<)/))
{
$comp_string = $filestring;
open(fileout,">> NOutput.txt") or dienice("Couldn't open Output.txt for writing: $!");
flock(fileout,2);
seek(fileout,0,2);
print fileout $comp_string,"\n";
close(fileout);
$filestring = substr($filestring, index($filestring,($filestring =~ /(\>\w+\<)/))+6, length($filestring))
}
Any help would be great!!