I written regex for the particular string as mentioned below. match group(1) is including the values. I would need only the string portion rather than values.
import re
line = "dev_interface_values, 123 23, 8 1"
line2= "my_port_values2, 1234, 81"
m = re.search(r'^\s*(.+), (.*\S)\s*$', line)
print m.group(1)
print m.group(2)
m1 = re.search(r'^\s*(.+), (.*\S)\s*$', line2)
print m1.group(1)
print m1.group(2)
Output:
dev_interface_values, 123 23
8 1
my_port_values2, 1234
81
Expecting Output as :
m.group(1) -> dev_interface_values
m.group(2) -> 123 23, 8 1
m.group(1) -> my_port_values2
m.group(2) -> 1234, 81