Regex weirdness -- Aargh!

Your regular expression fails for me if I put windows line endings in the string ("\r\n") instead of Linux ones ("\n"). The option

This is, because . does match only \r then, after that the regex demands to get a - but there is \n, so it fails.

So you have 3 options:

  1. Demand the client to deliver only Linux-Endings, but depending on the tech knowledge of the client that may be impossible
  2. Normalize the input before feeding to the RE-scan, which should be the easiest one
  3. replace the dots that shall match line endings by (?:\r|\n|\r\n), but the output needs to be cleaned up as well.