Reputation: 399
I need to replace all $postData[some_text]
with $postData['some_text']
.
I tried looking for (\$postData\[)+([a-zA-Z_+])+(\])
and replacing with $postData['$2']
but it only replaces some_text
with 't'
i.e. the last letter of some_text
. I don't get it, how do I keep the whole text?
Upvotes: 0
Views: 28
Reputation: 7361
Put the quantifier inside the parentheses so you capture everything:
\$postData\[+([a-zA-Z_+]+)\]
replacement pattern:$1
Upvotes: 2