Tutti Nuovi

user:thomas utente che ha creato il gist

title:mygist titolo del gist

filename:myfile.txt nome di file nel gist

extension:yml estensione del file nel gist

language:go linguaggio del file nel gist

topic:homelab gists with given topic

Entra


Tutti Nuovi Entra

All gists matching topic re

Più recente creazione
Meno recente creazione
Più recente aggiornamento
Meno recente aggiornamento

timmy / 使用 re 進行正規表示式匹配

0 mi piace
0 forks
1 files
Ultima volta attivo 9 months ago
re 模組提供強大的正規表示式功能,可用於文字搜尋、字串處理與資料驗證,適用於日誌分析、表單驗證與文字解析等場景。
pattern-matching python re regex text-processing validation
1 import re
2
3 # 定義正規表示式模式
4 pattern = r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b"
5
6 # 測試字串
7 text = "聯絡我們: support@example.com 或 visit@example.org"
8
9 # 搜尋第一個匹配的電子郵件
10 match = re.search(pattern, text)
Più nuovi Più vecchi

Creato da Opengist ⋅ Load: 13ms⋅

Italiano
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文