replace_pattern1 = /\\c(\d+)\[(.*?)\]/i replace_pattern2 = /\\d(\d+)\[(.*?)\]/i text.gsub!(replace_pattern1) {"\\c[#$1]#$2\\c[0]"} text.gsub!(replace_pattern2) {"\\c[#$1]\\d[#$2]\\c[0]"}
replace_patterns = { /\\c(\d+)\[(.*?)\]/i => "\\c[#$1]#$2\\c[0]", /\\d(\d+)\[(.*?)\]/i => "\\c[#$1]\\d[#$2]\\c[0]" } replace_patterns.each {|k, v| text.gsub!(k) {v}}
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |