søndag 7. mai 2023

Visual Studio code replace curly braces with brackets (PHP)

To replace curly braces with brackets using search and replace in Visual Studio code for PHP use this search/replace pattern: 

Enable regex search.

Example:

$image{0} to $image[0]

 

Search: (\$[a-z]+)\{(.)\} 

Replace: $1[$2]