// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"[幹乾淦贛干肏操糙去塞賽]?[林賃吝拎恁你他她它祂牠](娘|媽|老師|妹|祖?(嬤|媽|罵))(的|樂|叻|垃|勒|咧|([基唧雞機激][掰歪]))?|([基唧雞機激][掰歪])").unwrap();
let string = "幹
幹他媽的
幹你娘
乾
乾林老師
靠
靠北
靠杯
靠背
靠盃
靠腰
靠夭
哭夭
去你的
去你媽的
林北
恁北
恁娘
恁祖媽
機掰
賤
俗辣
他媽的
覽趴
懶趴
北爛
盧小
魯洨
色龜
肚爛
屌
啥小
三小
操
屁
唬爛
龜公
他奶奶的
犯賤
機車
智缺
你娘卡好
林老師
破麻
賽
操卒仔
操機歪
糙機掰
無懶趴
卡小
吃小
死魚眼
炭甲查某
糙你妹
GGININ
GG IN IN
GG IN IN DER
可惡 想揉
想揉
ㄈㄈ尺
英文原生:
CCR
Fuck off
Fuck
mother fucker
You SOB
son of a bitch
Go to hell
Shit-head
Asshole
You beast
Shit
fart
Idiot
damn it
God damn
God damn it
hypocrite
ass hole
ass licker
bitch
phycho
bastard
Whore
Slut
Shit-head
";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/