โค้ดต่อไปนี้ใช้ Python regex เพื่อแยกสตริงที่กำหนดด้วยตัวคั่นหลายตัว
ตัวอย่าง
import re
s = 'Beautiful; Soup\n is, good: Python* application'
result = re.split('; |, |\*|\n|:',s)
print result ผลลัพธ์
สิ่งนี้ให้ผลลัพธ์
['Beautiful', 'Soup', ' is', 'good', ' Python', ' application']