How can I capture a multiline pattern using a regular expressions in java?
- by lampShade
I have a text file that I need to parse using regular expressions. The text that I need to capture is in multiline groups like this:
truck
zDoug
Doug's house
(123) 456-7890
[email protected]
30
61234.56
8/10/2003
vehicle
eRob
Rob's house
(987) 654-3210
[email protected]
For this example I need to capture truck followed by the next seven lines.In other words, in this "block" I have 8 groups. This is what I've tried but it will not capture the next line:
(truck)\n(\w).
NOTE: I'm using the program RegExr to test my regex before I port it to Java.