字符类
%a --字母alpha %d --数字double %l --小写字母lower %u --大写字母upper %w --字母和数字word %x -- 十六进制 %z --代表0 zero %s --空白符 space %p --标点% 转义
修饰符
+ 一次或多次 * / - 0次或多次
例子
i,j = test = "int x;/* x */ int y;/* y */" s1 = string.gsub(test,"/%*.-%*/","<COMMENT>") --最短匹配 "int x;<COMMENT> int y;<COMMENT> s2 = string.gsub(test,"/%*.*%*/","<COMMENT>") --最长匹配 int x;<COMMENT> test2 = "<a> Hello World <a>" s3 = string.gsub(test2,"%b<>","") -- Hello World