In regex, .
by default does not match newlines in most languages. In your situation, you have a multilined string and the body thus don't match the regex \w+.*
since only the first line matches.
There are usually two ways to by-pass this:
Use a modifier/flag which makes
.
match newlines as well (but I don't know Camel, so I can't be sure how to do this, though adding(?s)
at the beginning of the regex might make this work just as well since that's the equivalent of setting that particular modifier/flag).Use a class containing both a character and its negation.
For example,
[\s\S]
contains\s
(whitespace character which includes newlines) and\S
which matches non-whitespace characters. Together, they will match everything, because\S
will match everything\s
doesn't match.You could have used
[\w\W]
just as well to give the same result, or[\d\D]
or similar constructs.