Here is a string
* '''A happy man is too satisfied with the present to dwell too much on the future.'''
** "My Future Plans" an essay written at age 17 for school exam (18 September 1896) ''The Collected Papers of Albert Einstein'' Vol. 1 (1987) Doc.22
I need to get the text which starts with only one * till the end of that line
Pattern pattern = Pattern.compile("\\*(.+?)\\n");
Matcher matcher = pattern.matcher(text);
List<String> s = new ArrayList<String>();
while (matcher.find()) {
s.add(matcher.group(1));
}
I tried the above code, but it matches even 2 * and also the text from * to new line is not coming up properly, what am I missing here?