use strict; use warnings; my $line = "some text Programming Languages: C++, Java Author: John Date Created: 20004-01-05 10:23"; my ($text) = $line =~ / ^[^:]* # Skip everything from the start of line until the first : :\s+ # Skip the : and any trailing white space ( # Capture (?: # Group, but don't capture (?! # look ahead an fail to match if given pattern found \s+\w+: # Pattern to fail on - space word : ). # Capture a character if the look ahead didn't fail )* # Do it as many times as possible ) # Close the capture /x; # x flag ignores most white space and allows comments print $text;