php - Extract from string using regex -
this question has answer here:
i need extract piece of string. have extract system.cpu.util[,idle] or net.if.out[eth2] respectively idle , eth2.
i don't know how detect correcty [ , ] can me?
here manual preg_match
var= net.if.out[eth2] preg_match('/\[,?(.*?)\]/', $var, $match); print match[1];
Comments
Post a Comment