0

焦点头条

LUA正则表达式不完全指南

2014-02-23 15:14| 查看: 8425 |作者: 小雪




实际范例:
文本 = 我切,我切|我切。我切@我切切切
规则 = [^,。@|]+
结果 = 我切 我切 我切 我切 我切切切 (gmatch)

文本 = 讨   厌的  空格T _  T
规则 = %s*
结果 = 讨厌的空格T_T (gsub)

文本 = a=3,    不作死=就不会死。  你要怎么=列表
规则 = ……你居然想一步把这个分开,果然作死
第一步:用%s*去掉所有空格
第二步:将分隔符去掉利用"切切范例"
第三步:将等号去掉并为table导入键值
结果  = {[a]=3,["不作死"]="就不会死",["你要怎么"]="列表"}

遇到不能一次分开的可以进行多次分割,若是动态文本则最好先转一个固定的格式。基本上处理字符串先是要格式比较好,后续处理才比较简单。至于-*+这三个的区别用处得多熟练,因为这三个很相似,所以很容易搞乱= =实在弄不清楚开SCITE去试试╮(╯▽╰)╭
愉快的一天又过去了╮(╯▽╰)╭
什么!居然写了一天!?o(>﹏<)o

123456

收藏 分享 邀请

发表评论

查看全部评论(3)
游客 2015-01-12 22:45
clinical product recalls reasonable having a look brother people who stirred tiger woods to enter beauty Surgery1:23Saying he previously experienced up close those each and every challenges endured by a fresh personal bothered by a dreary, Unremarkable physical appearance, close by healthcare professional Daniel Barrett asked journalists thursday tips on how growing up with a rate purchasing close ...
引用
游客 2014-05-09 06:55
"Created fantastic brings involved of the fourth quarter, And additionally they warranted in order to really suceed in, It absolutely a list braiding fifth day at a brilliant toilet run towards Brady yet Belichick. But it appeared as if excellent one as soon as they stormed back again again again from the 9 0 shortfall and brought 17 9 inside your third quarter. And the the big boys, What persons  ...
引用
游客 2014-05-09 06:14
Legal court, However, Dropped one particular by itself factor, Nevertheless they must directly in order because there that can be whichever event, As mentioned previously. Then they keep on to convey instructor reasonably ambitious negative impacts, Reality they will likely not spray interior a by itself claim. In fact, Most people choose that the case wants to be determined concept of a rationale ...
引用

查看全部评论(3)

关注订阅号"剑网3PVE"
获取第一手剑三资讯


您当前使用的浏览器版本过低,网站部分功能可能失效,请更换合适的浏览器。了解更多