Which of the following statements regarding the output of the function re.match is incorrect?

Bảo Vy

Member
Which of the following statements regarding the output of the function re.match is incorrect?
A. ‘pq*’ will match ‘pq’
B. ‘pq?’ matches ‘p’
C. ‘p{4}, q’ does not match ‘pppq’
D. ‘pq+’ matches ‘p’
 
Answer: d
Explanation: All of the above statements are correct except that ‘pq+’ match ‘p’. ‘pq+’ will match ‘p’ followed by any non-zero number of q’s, but it will not match ‘p’.
 

Tìm kiếm

Back
Top