Java, Regex and linebreaks
I am new to Regular expressions, so I am trying to figure this out. I wrote in a plain .txt file in Notepad:
Description1 This is a test of a description. Yay Description2.
I then used this regex in order to search and return the text between (But not including) the words Description1 and Description2
It works just as intended. But now I need to find a way for the regex to read linebreaks, so if the description is written like this:
Description1 This is a test of
a description. Yay Description2.
It will still return what I want it too. Ive done research, a lot of people say the same thing. Do Pattern.MULTILINE or Pattern.DOTALL, as well as adding (?S) at the beginning of the expression (In this case likely before the .*), or/and typing [\n\r] or something similar. I've tried many combinations of these things and nothing seems to work, it always says there is no match. Any help would be appreciated.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread