Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse / Aptana regex search and replace

In Aptana (Eclipse), I want to replace in a lot of file PHP associative array by objects :

$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

Any ideas welcome ! Thanks

like image 769
Amoeba Avatar asked Oct 22 '22 23:10

Amoeba


1 Answers

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

\$requete\[\"([\w]+)\"\]

like image 159
jmohr Avatar answered Oct 27 '22 10:10

jmohr