gsub("([ab])", "\\1_\\1_", "abc and ABC")[1] "a_a_b_b_c a_a_nd ABC" 分析:在后边查找a或b,查找到对每个字母后边加_ 转载于:https://www.cnblogs.com/blueicely/p/3421397.html