我有这样的文字,看起来像这样:Java的正则表达式讨论
executeRule(document, 'SendEmail', [
'emailAddress':'EMAIL([email protected])',
'subject':'Test',
'text':'Test',
'defaultText':'Test']
);
我需要为了得到该executeRule的参数用正则表达式解析它。
目前我正则表达式看起来像这样(JAVA):
List<String> partialRules = new ArrayList<String>();
List<String> rules = new ArrayList<String>();
Pattern p = Pattern.compile("executeRule\\(\\s*\\w+,\\s*'(\\w+)'\\s*,\\.*");
问题是我无法找到一个正则表达式,将符合我的executeRule方法3'rd参数。
任何帮助表示赞赏。
谢谢。
你不能用逗号使用分裂,因为第三个参数包含它。 – Zernike
它很好用,谢谢 – Sergiu
我怎样才能捕捉到甚至在方法的最后?截至目前,我匹配除了最后的整个方法; 谢谢 – Sergiu