Created
January 30, 2017 12:15
-
-
Save application2000/7c2032f7c9faecb3e9c9e8ad0c5bfbd7 to your computer and use it in GitHub Desktop.
PhpStorm regex to replace PHP object-like accessing to PHP array-like accessing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do you keep modifiying $my_variable->foo to $my_variable['foo'] over and over everyday? This regex is for you. | |
text to replace : (\$some_variable)(\->)([\w]+) | |
replacement : $1\[\'$3\'\] | |
Backup your files to prevent any problems. Use this with caution. At your own risk. | |
Usage: | |
1. Keyboard shortcut Cmd + R or equivalent to trigger a text replace | |
2. Click on the regex checkbox | |
3. Make sure case-sensitive is on (Match Case checkbox) | |
4. Change some_variable with your own | |
5. Click on Replace or Replace all | |
6. Enjoy the beauty of regular expressions! | |
Tested in PhpStorm 2016.3.2 on macOS Sierra 10.12.3 | |
PS: If there is some problem do Cmd + Z to undo changes. | |
Have a nice day. |
Author
application2000
commented
Dec 16, 2019
via email
No problem take care CJ McGregor
Le lun. 16 déc. 2019 à 12:03, CJ McGregor <[email protected]<mailto:[email protected]>> a écrit :
Just what I was looking for. Worked great. Thank you!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://gist.github.com/7c2032f7c9faecb3e9c9e8ad0c5bfbd7?email_source=notifications&email_token=AAOSXL4VLKOVAQXE2J46WNLQY6RGNA5CNFSM4J3MF3IKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAF6ABG#gistcomment-3112979>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAOSXLYK3KUB2LE6ZNLIP6DQY6RGNANCNFSM4J3MF3IA>.
…--
Monsieur Alexandre ELISÉ
Développeur web spécialiste Joomla!
Site web: https://www.application2000.com
Fuseau horaire: UTC -4
Horaires (à titre indicatif): 10h à12h et de14h à 17h
Monsieur Alexandre ELISÉ
Développeur web spécialiste Joomla!
Site web: https://alexandre-elise.fr<https://alexandre-elise.fr/>
Fuseau horaire: UTC -4
Horaires (à titre indicatif) : 10h-12h et 14h-17h
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment