Created
July 5, 2012 09:52
-
-
Save nelsonr/3052693 to your computer and use it in GitHub Desktop.
Revisions
-
nelsonr revised this gist
Jul 9, 2012 . No changes.There are no files selected for viewing
-
nelsonr revised this gist
Jul 9, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ Regex for PHP associative array keys that lack quotes ------------------------------------------------------ Find with: \$([a-z0-9_]*)\[(?!('|"))([a-z0-9_]*)(?!('|"))\] Replace with: $\1['\3'] \1 and \3 relate to groups in the expression that are whatever what's inside parentheses. The first and third group ([a-z0-9_]*) are equal and each one matches the variable name and the key name respectively -
nelsonr revised this gist
Jul 6, 2012 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,11 @@ Note! - This gist uses Komodo specific regex shortcuts Find with: \$([a-z0-9_]*)\[(?!('|"))([a-z0-9_]*)(?!('|"))\] Replace with: $\1['\3'] \1 and \3 relate to groups in the expression that are whatever what's inside parenthesis. The first and third group ([a-z0-9_]*) are equal and each one matches the variable name and the key name respectively ------------------------------------------------------ Matches the following: -
nelsonr revised this gist
Jul 6, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Note! - This gist uses Komodo specific regex shortcuts ------------------------------------------------------ Find with: \$([a-z0-9_]*)\[(?!('|"))([a-z0-9_]*)(?!('|"))\] Replace with: $\1['\3'] ------------------------------------------------------ -
nelsonr created this gist
Jul 5, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ Note! - This gist uses Komodo specific regex shortcuts ------------------------------------------------------ Find with: \$(.*)\[(?!('|"))(.*)(?!('|"))\] Replace with: $\1['\3'] ------------------------------------------------------ Matches the following: $your_var_name[your_assoc_key] Which will turn into: $your_var_name['your_assoc_key'] ------------------------------------------------------ Won't match: $your_var_name["your_assoc_key"] or $your_var_name['your_assoc_key']