in reply to Perl, SQLite3, and Parsing the Chatterbox Feed.
my $pat = qr{ .*<author>(.*)<\/author>.*<text>(.*)<\/text }xs;
use:
my $pat = qr{ .*?<author>(.*?)<\/author>.*?<text>(.*?)<\/text }xs;
Also, I'm not sure you are using the /g option correctly. I've had better luck with:
while ($data =~ m/$pat/gc) { my ($auth, $text) = ($1, $2); for( $text ) { s/[ ]+/ /g; s/^\s+//; s/\s+$//; } printf "%s: %s\n\n" , $auth , $text; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl, SQLite3, and Parsing the Chatterbox Feed.
by ikegami (Patriarch) on Feb 14, 2008 at 18:35 UTC | |
by parv (Parson) on Feb 15, 2008 at 03:00 UTC |