正規表達式

import re

text = "Email: test@example.com"
match = re.search(r'[\w]+@[\w]+\.[\w]+', text)
if match:
    print(match.group())  # test@example.com
💻 程式碼編輯器
📤 執行結果
等待執行...
← 上一課 下一課 →