I have the following text:
(Some text before...)
display_name = lo
name = lo
is_up = 1
index = 1
is_virtual = 0
is_point_to_point = 0
MTU = 65536
hardware_address = (null)
parent = (null)
ip_counter = 2
inet6 addr = /::1
inet addr = /127.0.0.1
---------------End_of_text---------------------
(Some text after...)
I'm trying to get this all part between "display_name = lo" and "---------------End_of_text---------------------", when "display_name = lo" and "End_of_text" are not include.
I tried to run the following:
String pattern = "^\\sdisplay_name = lo\\s+(.*)---------------End_of_text---------------------";
Pattern r = Pattern.compile(pattern, Pattern.DOTALL);
Matcher m = r.matcher(interfaceData);
if (m.find()){
System.out.println("Group 0 found value: " + m.group(0) );
System.out.println("Group 1 found value: " + m.group(1) );
System.out.println("Group 2 found value: " + m.group(2) );
}
else {System.out.println("NO MATCH");}
There is no match, what am I missing?