in reply to regexp need a match characters and spaces

I would suggest a lookahead for a new line... It will work in this case, but not if the b row is the last row in your parsed variable (unless you force it to have a newline as the last character always). e.g. ($c) = $a =~ m{^b\s+(.*?)(?>\n)$}m ; Needs some tweaking if b is the last row... -m