โค้ดต่อไปนี้ใช้อักขระ Python regex .()dot สำหรับอักขระตัวแทนซึ่งหมายถึงอักขระใดๆ ที่ไม่ใช่การขึ้นบรรทัดใหม่
ตัวอย่าง
import re
rex = re.compile('th.s')
l = "this, thus, just, then"
print rex.findall(l) ผลลัพธ์
ให้ผลลัพธ์
['this', 'thus']
โค้ดต่อไปนี้ใช้อักขระ Python regex .()dot สำหรับอักขระตัวแทนซึ่งหมายถึงอักขระใดๆ ที่ไม่ใช่การขึ้นบรรทัดใหม่
import re
rex = re.compile('th.s')
l = "this, thus, just, then"
print rex.findall(l) ให้ผลลัพธ์
['this', 'thus']