modified regex to handle windows line endings