Hi,
glad that i could help you.
The [^\n] is a negated character class. Here it represents all characters which aren't "newlines". The newline-characters remained, though undefined $/, still in your string.
The regex [^\n]+\n matches on 1-n non-newlines followed by a newline.
After this there can be 0-n whitespaces \s* followed by another newline. This is your blank-line.
greetings, tos |