regex modified to handle line endings on windows