// 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#"(\S{1,2})(:")(['a-z]*)(",)"#).unwrap();
let string = "ã‚:\"a\",ã„:\"i\",ã†:\"u\",ãˆ:\"e\",ãŠ:\"o\",ã‚”ã:\"va\",ã‚”ãƒ:\"vi\",ã‚”:\"vu\",ã‚”ã‡:\"ve\",ã‚”ã‰:\"vo\",ã‹:\"ka\",ã:\"ki\",ãゃ:\"kya\",ããƒ:\"kyi\",ãã‚…:\"kyu\",ã:\"ku\",ã‘:\"ke\",ã“:\"ko\",ãŒ:\"ga\",ãŽ:\"gi\",ã:\"gu\",ã’:\"ge\",ã”:\"go\",ãŽã‚ƒ:\"gya\",ãŽãƒ:\"gyi\",ãŽã‚…:\"gyu\",ãŽã‡:\"gye\",ãŽã‚‡:\"gyo\",ã•:\"sa\",ã™:\"su\",ã›:\"se\",ã:\"so\",ã–:\"za\",ãš:\"zu\",ãœ:\"ze\",ãž:\"zo\",ã—:\"shi\",ã—ゃ:\"sha\",ã—ã‚…:\"shu\",ã—ょ:\"sho\",ã˜:\"ji\",ã˜ã‚ƒ:\"ja\",ã˜ã‚…:\"ju\",ã˜ã‚‡:\"jo\",ãŸ:\"ta\",ã¡:\"chi\",ã¡ã‚ƒ:\"cha\",ã¡ã‚…:\"chu\",ã¡ã‚‡:\"cho\",ã¤:\"tsu\",ã¦:\"te\",ã¨:\"to\",ã :\"da\",ã¢:\"di\",ã¥:\"du\",ã§:\"de\",ã©:\"do\",ãª:\"na\",ã«:\"ni\",ã«ã‚ƒ:\"nya\",ã«ã‚…:\"nyu\",ã«ã‚‡:\"nyo\",ã¬:\"nu\",ã:\"ne\",ã®:\"no\",ã¯:\"ha\",ã²:\"hi\",ãµ:\"fu\",ã¸:\"he\",ã»:\"ho\",ã²ã‚ƒ:\"hya\",ã²ã‚…:\"hyu\",ã²ã‚‡:\"hyo\",ãµã:\"fa\",ãµãƒ:\"fi\",ãµã‡:\"fe\",ãµã‰:\"fo\",ã°:\"ba\",ã³:\"bi\",ã¶:\"bu\",ã¹:\"be\",ã¼:\"bo\",ã³ã‚ƒ:\"bya\",ã³ã‚…:\"byu\",ã³ã‚‡:\"byo\",ã±:\"pa\",ã´:\"pi\",ã·:\"pu\",ãº:\"pe\",ã½:\"po\",ã´ã‚ƒ:\"pya\",ã´ã‚…:\"pyu\",ã´ã‚‡:\"pyo\",ã¾:\"ma\",ã¿:\"mi\",ã‚€:\"mu\",ã‚:\"me\",ã‚‚:\"mo\",ã¿ã‚ƒ:\"mya\",ã¿ã‚…:\"myu\",ã¿ã‚‡:\"myo\",ã‚„:\"ya\",ゆ:\"yu\",よ:\"yo\",ら:\"ra\",ã‚Š:\"ri\",ã‚‹:\"ru\",ã‚Œ:\"re\",ã‚:\"ro\",りゃ:\"rya\",ã‚Šã‚…:\"ryu\",りょ:\"ryo\",ã‚:\"wa\",ã‚’:\"wo\",ã‚“:\"n\",ã‚:\"wi\",ã‚‘:\"we\",ãã‡:\"kye\",ãょ:\"kyo\",ã˜ãƒ:\"jyi\",ã˜ã‡:\"jye\",ã¡ãƒ:\"cyi\",ã¡ã‡:\"che\",ã²ãƒ:\"hyi\",ã²ã‡:\"hye\",ã³ãƒ:\"byi\",ã³ã‡:\"bye\",ã´ãƒ:\"pyi\",ã´ã‡:\"pye\",ã¿ã‡:\"mye\",ã¿ãƒ:\"myi\",ã‚Šãƒ:\"ryi\",ã‚Šã‡:\"rye\",ã«ãƒ:\"nyi\",ã«ã‡:\"nye\",ã—ãƒ:\"syi\",ã—ã‡:\"she\",ã„ã‡:\"ye\",ã†ã:\"wha\",ã†ã‰:\"who\",ã†ãƒ:\"wi\",ã†ã‡:\"we\",ゔゃ:\"vya\",ゔゅ:\"vyu\",ゔょ:\"vyo\",ã™ã:\"swa\",ã™ãƒ:\"swi\",ã™ã…:\"swu\",ã™ã‡:\"swe\",ã™ã‰:\"swo\",ãゃ:\"qya\",ãã‚…:\"qyu\",ãょ:\"qyo\",ãã:\"qwa\",ããƒ:\"qwi\",ãã…:\"qwu\",ãã‡:\"qwe\",ãã‰:\"qwo\",ãã:\"gwa\",ããƒ:\"gwi\",ãã…:\"gwu\",ãã‡:\"gwe\",ãã‰:\"gwo\",ã¤ã:\"tsa\",ã¤ãƒ:\"tsi\",ã¤ã‡:\"tse\",ã¤ã‰:\"tso\",ã¦ã‚ƒ:\"tha\",ã¦ãƒ:\"thi\",ã¦ã‚…:\"thu\",ã¦ã‡:\"the\",ã¦ã‚‡:\"tho\",ã¨ã:\"twa\",ã¨ãƒ:\"twi\",ã¨ã…:\"twu\",ã¨ã‡:\"twe\",ã¨ã‰:\"two\",ã¢ã‚ƒ:\"dya\",ã¢ãƒ:\"dyi\",ã¢ã‚…:\"dyu\",ã¢ã‡:\"dye\",ã¢ã‚‡:\"dyo\",ã§ã‚ƒ:\"dha\",ã§ãƒ:\"dhi\",ã§ã‚…:\"dhu\",ã§ã‡:\"dhe\",ã§ã‚‡:\"dho\",ã©ã:\"dwa\",ã©ãƒ:\"dwi\",ã©ã…:\"dwu\",ã©ã‡:\"dwe\",ã©ã‰:\"dwo\",ãµã…:\"fwu\",ãµã‚ƒ:\"fya\",ãµã‚…:\"fyu\",ãµã‚‡:\"fyo\",ã:\"a\",ãƒ:\"i\",ã‡:\"e\",ã…:\"u\",ã‰:\"o\",ゃ:\"ya\",ã‚…:\"yu\",ょ:\"yo\",ã£:\"\",ã‚•:\"ka\",ã‚–:\"ka\",ã‚Ž:\"wa\",\" \":\" \",ã‚“ã‚:\"n'a\",ã‚“ã„:\"n'i\",ã‚“ã†:\"n'u\",ã‚“ãˆ:\"n'e\",ã‚“ãŠ:\"n'o\",ã‚“ã‚„:\"n'ya\",んゆ:\"n'yu\",んよ:\"n'yo\",";
let substitution = ":*:\\3::\\1\\n";
// result will be a String with the substituted value
let result = regex.replace_all(string, substitution);
println!("{}", result);
}
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/