ควิซ Python Regular Expressions (re)

This Python quiz tests the re module and the regular expression syntax you use most. You will predict what findall, search, match, sub and split return, and learn to spot greedy patterns, missing raw strings and None results.

ปานกลาง 10 ข้อ ~6 นาที ผ่านที่ 80% Python 3.12

เลือกโหมด

กำลังเล่นแบบผู้เยี่ยมชม: เข้าสู่ระบบเพื่อเก็บ XP และ streak

ตัวอย่างคำถาม

ข้อ 1 จาก 10

What does this print?

import re

print(re.findall(r"\d+", "a1b22c333"))
ดูเฉลย

C. ['1', '22', '333'] \d+ matches one or more digits in a row, and findall returns every match as a string. Without the + you would get each digit separately.

ควิซนี้มีเนื้อหาอะไรบ้าง

  • search vs match vs fullmatch
  • findall with and without groups
  • Greedy vs lazy quantifiers
  • Groups and back-references in re.sub
  • Raw strings and checking for None

คำถามที่พบบ่อย

ต้องมีบัญชีไหม?

ไม่ต้อง ใครก็เล่นได้ เข้าสู่ระบบเพื่อเก็บ XP, streak, เหรียญตรา และประวัติ

ใช้ Python เวอร์ชันไหน?

Python 3.12 ทุกคำถามเกี่ยวกับผลลัพธ์ผ่านการรันโค้ดจริงเพื่อตรวจสอบแล้ว

ทำซ้ำได้ไหม?

ได้ ระบบเก็บคะแนนที่ดีที่สุดไว้ และสลับคำถามกับตัวเลือกใหม่ทุกครั้ง