如果不用 Ruby,我真不知道该怎么办
@@rules = [{ # 文件名转换规则 :from => /^(?\S+?) (?[^+])+(?[^+])+(?[^+])+((?[^+])+)?(?[^+]*)+(?[^+]+)$/, :to => '2013 年度\k-\k-\k-\k\k-\k-\k-20130620', }, { :from => /^(?.+?) (?.+?)((?.+?))(?.+?)( |—)(?.+)$/, :to => '2013 年度\k-\k-\k--\k-\k', }, { :from => /^(?.+?)( |--)(?.+?)(-|--)(?[^-]+)$/, :to => '2013 年度---\k-\k-\k-2013-06-20', }, { :from => /^(?.+?)(\s+|--)(?[^ -—]+?)(-+|—| )(?[^ -—]+?)((-+|—| )(?\d+))?$/, :to => '2013 年度---\k-\k-\k-\k', }, { :from => /^(?[^ -]+?)( |--)(?.+?)/, :to => '2013 年度---\k-\k--2013-06-20', }]
文件名转换成功率达到了 99.69%(319/320)。