到目前为止我有这个:
(require|include)(_once)?\(([^)]+)它检查所有require,require_once,include和include_once,但它需要采用以下格式:
require(FOO)我还需要找到:
require FOO所以它需要考虑括号和不带括号以及第二个例子中的空间。
完整代码的样式将是:
<search position="replace" regex="true"><![CDATA[~(require|include)(_once)?\(([^)]+)~]]></search> <add><![CDATA[$1$2(VQMod::modCheck($3)]]></add>So far i have this:
(require|include)(_once)?\(([^)]+)which it checks for all require, require_once, include and include_once but it requires to be in the format of:
require(FOO)I need to also find:
require FOOso it needs to take into consideration with and without parentheses as well as the space that would be in the second example.
a style of the full code would be:
<search position="replace" regex="true"><![CDATA[~(require|include)(_once)?\(([^)]+)~]]></search> <add><![CDATA[$1$2(VQMod::modCheck($3)]]></add>最满意答案
您可以使用分支重置:( (?|...|...)
(require|include)(_once)?(?|\(([^)]+)\)| ([^\s;]+))分支重置功能的主要兴趣在于内部的捕获组具有相同的编号。
根据George Reith的评论,你必须找到非括号案例的好字符类。 如果遇到白色空格或分号,我选择[^\s;]来停止。
另一种方式:( 我不在乎是否有括号)
(require|include)(_once)?[( ]([^\s;)]+)另一种方式:( 如果那么其他)
(require|include)(_once)?(\()?(?(3)| )([^\s;)]+)(对于最后一种方式,请注意文件名在组4中)
You can use a branch reset: (?|...|...)
(require|include)(_once)?(?|\(([^)]+)\)| ([^\s;]+))The main interest of the branch reset feature is that the capture groups inside have the same number.
According to George Reith comment, you must find the good character class for the non-parenthesis case. Here I have choosen [^\s;] to stop if a white-space or a semi-colon is encountered.
An other way: (I don't care if there are parenthesis or not)
(require|include)(_once)?[( ]([^\s;)]+)An other way: (If Then else)
(require|include)(_once)?(\()?(?(3)| )([^\s;)]+)(For this last way, note that the file name is in group 4)
更多推荐
发布评论