我在 AS3 中有几个正则表达式,它们是用内联 AS3 正则表达式语法定义的,例如:
/\/\*[\s\S]*?\*\//gm
我想将其转换为 AS3 RegEx 类构造函数,例如:
new RegExp('/\/\*[\s\S]*?\*\//', "gm")
我不确定是否必须转义反斜杠。你知道如何转换吗?
/** ------------------------- Regular Expressions ---------------------------- */
public static var multiLineCComments:RegExp = /\/\*[\s\S]*?\*\//gm;
public static var singleLineCComments:RegExp = /\/\/.*$/gm;
public static var singleLinePerlComments:RegExp = /#.*$/gm;
public static var doubleQuotedString:RegExp = /"([^\\"\n]|\\.)*"/g;
public static var singleQuotedString:RegExp = /'([^\\'\n]|\\.)*'/g;
public static var multiLineDoubleQuotedString:XRegExp = new XRegExp('"([^\\\\"]|\\\\.)*"', 'gs');
public static var multiLineSingleQuotedString:XRegExp = new XRegExp("'([^\\\\']|\\\\.)*'", 'gs');
public static var xmlComments:RegExp = /(<|<)!--[\s\S]*?--(>|>)/gm;
public static var url:RegExp = /\w+:\/\/[\w-.\/?%&=:@;]*/g;