in reply to Disambuating $ in (especially /m) regexps

Why do you think you need $ at all? especially when combined with /s?

Just match the line ending if you want it, ...[\r\n]+...