Given text exposure for example
Preface (optional, up to multiple lines)
Main : sequence1
sequence2
sequence3
sequence4
Epilogue (optional, up to multiple lines)
which is Javaa regular expression can be used to retrieve all the sequences (i.e. sequence1, sequence2, sequence3, sequence4above)? For example, a loop Matcher.find()?
Each "sequence" is preceded and may also contain 0 or more white spaces (including tabs).
Next regex
(?m).*Main(?:[ |t]+:(?:[ |t]+(\S+)[\r\n])+
gives only the first sequence ( sequence1).
source
share