Reputation: 13
I'm using Sublime 3 for a string replace task inside a lengthy PHP file. I would like to achieve the following.
Turn all instances of this pattern (there are about 100):
$data['xyz']
Into this:
Mything()->settings->get('xyz')
Throughout the PHP file, the pattern is identical to above except the 'xyz' part differs from instance to instance and should be preserved by the regex.
Upvotes: 0
Views: 2440
Reputation: 4981
Using regular expressions
Find:
\$data\['(.*?)'\]
Replace:
Mything()->settings->get('\1')
Don't forget to enable Regular Expressions while using find and replace in SublimeText
Upvotes: 3