How do I write a regular expression that matches the following string:
Each item that needs to be matched is terminated with a space
Server_model=proliant DL360 G5; Server_cpu_model=intel (R) Xeon (r) CPU E5405 @ 2.00GHz; Cpu=21mhz;1;3;5;8
Reply to discussion (solution)
The question is not clear.
$s = "server_model=proliant DL360 G5;; Server_cpu_model=intel (R) Xeon (r) CPU E5405 @ 2.00GHz;; cpu=21mhz;1;3;5;8 ";p Reg_match_all ('/\s* (\s.+) (?:;; | $)/U ', $s, $m);p rint_r ($m [1]);
Array ( [0] = server_model=proliant DL360 G5 [1] = Server_cpu_model=intel (r) Xeon (r) CPU E5405 @ 2.00GHz [2] = = cpu=21mhz;1;3;5;8)
Thanks for the reply, already very close, but I added 2 data test, found a little problem, please help. Thank you!
Server_model=proliant DL360 G5; Server_cpu_model=intel (R) Xeon (r) CPU E5405 @ 2.00GHz; swap=3989mb;0;0;0;3999 memory=158mb;;;; 1869