$tmp =~ s/((?:\s*(?:.{1,$short_line_threshold})<\/line>\s*){$short_line_counter,})(\s*(?:.{$long_line_threshold,}?)<\/line>)/$1<\/para>$2/gs;