【发布时间】:2014-07-18 14:38:10
【问题描述】:
我有一些调用函数的混淆代码,如下所示:
getAny([["text with symbols \"()[],.;\" and maybe 'ImVerySeriousFn'"], ...]);
setAny([["other text with \"()[],.;\""], ...]);...
参数包含随机文本。函数相互跟随,没有换行。
如何使用正则表达式集获取getAny、setAny 和其他函数的参数?
我需要这个结果:
regex1 result: [["text with symbols \"()[],.;\" and maybe 'ImVerySeriousFn'"], ...]
regex2 result: [["other text with \"()[],.;\""], ...]
...
我试着写regex1:
getAny\((.*)\)
但匹配结果中也包含setAny调用
[["text with symbols \"()[],.;\" and maybe 'ImVerySeriousFn'"], ...]);setAny([["other text with \"()[],.;\""], ...]
当我尝试时:
getAny\((.*?)\)
匹配结果中断参数字符串
[["text with symbols \"(
我不能按; 或); 进行拆分,因为参数中的文本可以包含符号; 或);
使用正则表达式可能无法做到这一点?
【问题讨论】:
-
解析器可能是更好的方法,但是this?:
[gs]etAny\((.*)\) -
不幸的是,函数相互跟随,没有换行。
[gs]etAny\((.*)\)- it does not work.
标签: regex