How to write a regular expression that matches the following string:
Each project to be matched ends with a space.
Server_model = ProLiant DL360 G5; server_cpu_model = Intel (R) Xeon (R) CPU E5405 @ 2.00 GHz; cpu = 21 mhz; 1; 3; 5; 8
Reply to discussion (solution)
Not clear
$ S = "server_model = ProLiant DL360 G5; server_cpu_model = Intel (R) Xeon (R) CPU E5405 @ 2.00 GHz; cpu = 21 mhz; 1; 3; 5; 8 "; preg_match_all ('/\ s * (\ S. + )(? :; | $)/U', $ s, $ m); print_r ($ m [1]);
Array ([0] => server_model = ProLiant DL360 G5 [1] => server_cpu_model = Intel (R) Xeon (R) CPU E5405 @ 2.00 GHz [2] => cpu = 21 mhz; 1; 3; 5; 8)
Thanks for your reply. it's very close. but I added two data tests and found some minor problems. please help me. Thank you!
Server_model = ProLiant DL360 G5; server_cpu_model = Intel (R) Xeon (R) CPU E5405 @ 2.00 GHz; swap = 3989 MB; 0; 0; 0; 3999 memory = 158 MB; 1869