my $str2 = "Be careful what you wish for you just might get it http://www.perlmonks.com/?parent=943112;node_id=3333 ---------------test-----------resutls----------!"; (my $break3 = $str2)=~ s/([^http.*?\s+]\S{30})/$1 /g; print "\n\n$break3\n\n";