From: Markus Schirp Date: 2008-09-29T07:41:41+09:00 Subject: multiline regexp and newlines Hello Community, Im trying to reject any newline in a string using regexp. The string must not be empty. Yes, this can be done without regexp. So my Regexp is like: "Match any character from the begin to the end of a string witch is not newline, and ensure there is at least one character, and to this match over multiple lines (so if there are multiple lines reject it)" Results in /^[^\n]+$/m My ruby 1.8.6 does: /^[^\n]+$/m =~ "a\n" -> 0 without multiline flag the same: /^[^\n]+$/ =~ "a\n" -> 0 But: /^[^\n]+$/m =~ "\n" -> nil If I replace "reject newline" with "reject character x" it worked as expected (x is 'a' in this example): /^[^a]+$/m =~ "ba" -> nil Is the multiline-regexp implementation broken or my multiline behaviour expectation? Mfg Markus Schirp