From 6f16e5fbfcfd9e50231298152dc330509da02bca Mon Sep 17 00:00:00 2001 From: Brian O'Donnell Date: Thu, 23 Apr 2015 13:43:55 -0400 Subject: [PATCH] Fixed tag parsing for strings with parentheses and other punctuation --- pod_feeder.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pod_feeder.pl b/pod_feeder.pl index a96cc92..e03c97b 100755 --- a/pod_feeder.pl +++ b/pod_feeder.pl @@ -204,7 +204,7 @@ sub get_feed_items { $link_part =~ s/(\?.*)$//; # split up string - my @parts = split( /[^(\p{Letter}|\p{Number})]/, $link_part ); + my @parts = split( /([^(\p{Letter}|\p{Number})]|\p{Punctuation})/, $link_part ); push( @hashtags, @parts ); } @@ -212,9 +212,14 @@ sub get_feed_items { # try to guess tags from the title if( $params{'extract_tags_from_title'} ){ # split up string on non-alphanumerics - my @parts = split( /[^(\p{Letter}|\p{Number})]/, $item->{'title'} ); + my @parts = split( /([^(\p{Letter}|\p{Number})]|\p{Punctuation})/, $item->{'title'} ); + my @tags = (); - push( @hashtags, @parts ); + foreach my $part ( @parts ){ + push( @tags, $part ) unless $part =~ m/^(\s+)?$/; + } + + push( @hashtags, @tags ); } # try to extract tags from the feed categories (if they exist)