Regular expression solving

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

  • 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.