Regular expression solving-php Tutorial

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.