In Aptana (Eclipse), I want to replace in a lot of file PHP associative array by objects :
在Aptana(Eclipse)中,我希望用对象替换很多文件PHP关联数组:
$requete["something"]
by
$row->something
I've tried this, SEARCH :
我试过这个,搜索:
\$requete\[\"([\w.])+\"\]
with, REPLACE:
\$row->$1
but the regex engine only takes the last character of the search : g for something
但正则表达式引擎只占用搜索的最后一个字符:g表示某些内容
Any ideas welcome ! Thanks
欢迎任何想法!谢谢
2 个解决方案
#1
2
The reason the regex is only matching the last character of the group is the plus sign is outside the word match group. Also, the period is unneeded.
正则表达式仅匹配组的最后一个字符的原因是加号在单词匹配组之外。而且,这段时间是不需要的。
To fix the Regex, replace the period after the w
with the plus sign
要修复正则表达式,请使用加号替换w之后的句点
\$requete\[\"([\w]+)\"\]
#2
1
Use \$requete\[\"(\w+?)\"\]
for regex in the search portion. The issue with your current regex is that you are using the quantifier outside of the capturing group.
在搜索部分使用\ $ requete \ [\“(\ w +?)\”\]表示正则表达式。当前正则表达式的问题在于您正在使用捕获组之外的量词。
#1
2
The reason the regex is only matching the last character of the group is the plus sign is outside the word match group. Also, the period is unneeded.
正则表达式仅匹配组的最后一个字符的原因是加号在单词匹配组之外。而且,这段时间是不需要的。
To fix the Regex, replace the period after the w
with the plus sign
要修复正则表达式,请使用加号替换w之后的句点
\$requete\[\"([\w]+)\"\]
#2
1
Use \$requete\[\"(\w+?)\"\]
for regex in the search portion. The issue with your current regex is that you are using the quantifier outside of the capturing group.
在搜索部分使用\ $ requete \ [\“(\ w +?)\”\]表示正则表达式。当前正则表达式的问题在于您正在使用捕获组之外的量词。