Is possible, in java, to make a regex for matching the end of the string but not the newlines, using the Pattern.DOTALL option and searching for a line with \n?
Examples:
1)
aaa\n==test==\naaa\nbbb\naaa
2)
bbb\naaa==toast==cccdd\nb\nc
3)
aaa\n==trick==\naaaDDDaaa\nbbb
I want to match
\naaa\nbbb\naaa
and
cccdd\nb\nc
but, in the third example, i don't want to match text ater DDD.
\naaa