I to parse multiple lines of text that, for example, look like this:
{"Name":"pathology[876]", "cpu":"0.58","mem":"18.39", "vm":"1542.14"}
{"Name":"/opt/pathology/bin/pathology[876]", "cpu":"0.58","mem":"18.39", "vm":"1542.14"}
{"Name":"/usr/sbin/ofonod[760]", "cpu":"0.00","mem":"0.00", "vm":"0.00"}
{"Name":"/opt/networking/bin/network_manager[370]", "cpu":"0.20","mem":"53.43", "vm":"4225.69"}
{"Name":"/usr/bin/dmrouterd[913]", "cpu":"0.00","mem":"0.00", "vm":"0.00"}
I have to extract every process name, but some come alone and as well with their related path which I have to ignore, for example: pathology[876] is that same thing as /opt/pathology/bin/pathology[876]. I have to generalize this process to take the process name indifferently of the path. How could I take the desired string between the last / and the end of the string?
So far I have computed the following regex that treats paths like: /opt/<anything>/bin/<anything> extracting part after bin/, but there is a problem where the path is longer, for example /opt/<anything>/bin/pat/pathology[876] I get pat/pathology[876] while I would want only pathology[876].
"(Name)":("\/opt\/(.*?)\/bin\/(.*?)"|"(.*?)")