Fix regex to match Windows line endings

Fixes #5662
Merge pull request #5664 from concreted/patch-3

Fix regex to match Windows line endings