I'm going to take out the string "USER=ASDASD; Token=dwwewee; Type=assdfs "The token value Dwwewee,
How does PHP write?
Really can't write.
It's not like that either.
preg_match("/(token=)(.*?)(;|$)/i","user=asdasd; token=dwwewee; type=assdfs", $matches);foreach ($matches as $m){ echo $m;echo "
";}
Reply content:
I'm going to take out the string "USER=ASDASD; Token=dwwewee; Type=assdfs "The token value Dwwewee,
How does PHP write?
Really can't write.
It's not like that either.
preg_match("/(token=)(.*?)(;|$)/i","user=asdasd; token=dwwewee; type=assdfs", $matches);foreach ($matches as $m){ echo $m;echo "
";}
(?<=token=).*(?=;)
if (preg_match("/(token=)(.*?)(;|$)/i","user=asdasd; token=dwwewee; type=assdfs", $matches)) { print_r($matches[2]);}
If the match succeeds, the result is stored in the $matches array, index 0 is the complete string of matches, 1 is your first parenthesis, 2 is the second parenthesis, and so on. From your perspective, the value you need is in the second bracket, so the value $matches [2]
php
//php5.6 echo explode('=',explode(';',$str)[1])[1];//dwwewee$arr = explode(';',"user=asdasd; token=dwwewee; type=assdfs");$arr2 = explode('=',$arr[1]);echo $arr2[1];//dwwewee