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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -