'regex get number betwen quotes
i have difrent string json type egz formats in line
{"env":"stato","usc":"00000000","isc":"000100","sn":"0120xxxxmacxxx"}
{{"cmd":"stat"},{"usc":"00000000",{"isc":"1001000"}},"sn":"0120xxxxmacxxx"}
{{"cmd":"status","usc":"00000000","isc":"1110001"},"sn":"0120xxxxmacxxx"}
{'stat':'dev',{data:['usc':'00000000','isc':'10010001']},'sn':'0120xxxxmacxxx'}
need single regex by get only numbers 0-1 format in quotes after "isc":"NEED THIS NUMBERS ONLY" in single php regex for all formats. egs
$json = '{"env":"stato","usc":"00000000","isc":"00010000","sn":"0120xxxxmacxxx"}';
$find = "isc";
function find_data($find,$json){
preg_match('/,[{[]*["\']'.$find.'["\']:["\'](.*)["\'][}]]*,/i', $json, $r);
return $r;
}
json loop solution does not come! json search can only be accepted on one line of code, I have limited computing and memory resources in atmega 16
thx for help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
