I would like to ask you how to obtain the total score of level 4 and Level 6 after revision by using regular expressions (I will obtain the total score of the old version)

Source: Internet
Author: User
I would like to ask you how to obtain the total score of level 4 and Level 6 after revision by using regular expressions (I will obtain the total score of the old version) This is a 46-level website.
 
 
Name: Zhao Yang
Schools: Changchun University of Traditional Chinese Medicine
Exam type: English 4
Admission Ticket No: 220090132112529
Exam time: December 2013
Total score: 0
Hearing: 000
Read: 000
Writing and translation: 000

This is my code
$ A = curl_exec ($ ch); $ match = "#(.*)# "; // $ Match = "#(. *) # "; preg_match_all ($ match, $ a, $ B); $ yourname = $ B [1] [0]; $ school = $ B [1] [1]; $ cet = $ B [1] [2]; $ c = $ B [1] [5]; // score $ score = strip_tags ($ c); $ score = str_replace ("", "", $ score); return array ('school '=> $ school, 'name' => $ yourname, 'cet '=> $ cet, 'Score' => $ score );

All others can be obtained, and the total score cannot be obtained.


Reply to discussion (solution)

$ A = <TXT
 
 
Name: Zhao Yang
Schools: Changchun University of Traditional Chinese Medicine
Exam type: English 4
Admission Ticket No: 220090132112529
Exam time: December 2013
Total score: 0
Hearing: 000
Read: 000
Writing and translation: 000
TXT; $ match = "# (.*?)# Is "; preg_match_all ($ match, $ a, $ B); $ B [1] [11] = preg_replace ('/\ s /','', strip_tags ($ B [1] [11]); print_r ($ B [1]);
Array
(
[0] => name:
[1] => Zhao Yang
[2] => School:
[3] => Changchun University of Traditional Chinese Medicine
[4] => test type:
[5] => CET-4
[6] => admission ticket No:
[7] = & gt; 220090132112529
[8] => test time:
[9] => December 2013
[10] => Total score:
[11] => 0 listening: 000 reading: 000 writing and translation: 000
)

$ A = <TXT
 
 
Name: Zhao Yang
Schools: Changchun University of Traditional Chinese Medicine
Exam type: English 4
Admission Ticket No: 220090132112529
Exam time: December 2013
Total score: 0
Hearing: 000
Read: 000
Writing and translation: 000
TXT; $ match = "# (.*?)# Is "; preg_match_all ($ match, $ a, $ B); $ B [1] [11] = preg_replace ('/\ s /','', strip_tags ($ B [1] [11]); print_r ($ B [1]);
Array
(
[0] => name:
[1] => Zhao Yang
[2] => School:
[3] => Changchun University of Traditional Chinese Medicine
[4] => test type:
[5] => CET-4
[6] => admission ticket No:
[7] = & gt; 220090132112529
[8] => test time:
[9] => December 2013
[10] => Total score:
[11] => 0 listening: 000 reading: 000 writing and translation: 000
)


But the content in $ a should be changed.

The content is changed and the format is fixed.
Otherwise, it doesn't matter "Collection ".

The content is changed and the format is fixed.
Otherwise, it doesn't matter "Collection ".


Is there a question about the last line?> Error
I took this
$ Match = "# (.*?)# Is ";
Escape or error

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.