Regular Expressions 101

Community Library Entry

0

Regular Expression
Python

r"
((?<=\[)\w+)(?#匹配宏名称)|(\w+(?=\=))(?#匹配参数名称)|((?<=\=)\d+)(?#匹配int参数)|((?<=\=)\[\d+,\d+\])(?#匹配长度为2的int数组)|((?<=\=)\[\d+,\d+,\d+,\d+])(?#匹配长度为4的int数组)|(\"[a-zA-Z\._0-9\s]+\")(?#匹配使用双引号的string参数)|(\'[a-zA-Z\._0-9\s]+\')(?#匹配使用单引号的string参数)
"
gm

Description

简体中文:

用于解析bkengine的宏代码 如果代码的开头是形如// 这种注释,你需要先通过编程代码手动判断此行的开头是否为注释,如果是,则不处理后面的diam 如果注释在宏代码的后面 此正则不会处理在尾部的单行注释 注:此宏仅支持当行宏匹配(多行宏匹配可能会出现小问题)

English: (translated by machine) Macro code for parsing bkengine If the code starts with a comment like //, you need to manually determine if the line starts with a comment by programming the code first, and if so, the subsequent diam will not be processed If the comment is after the macro code, then this macro will not process a single line comment at the end. Note: this macro only supports in-line macro matching (multi-line macro matching may cause minor problems)

笔记 Translated with www.DeepL.com/Translator (free version)

Submitted by 小沙盒工作室 - 2 years ago (Last modified 2 years ago)