Regular Expressions (RegEx) → How to take a text list and surround each line in quotes
If you have a list from a text file such as this:
And you want this, let’s say for an array:
You need to use a find and replace in your IDE (I’m using PHPStorm). Enable the ability to RegEx in your Find & Replace.
Then for your find:
And your replace:
This will select all the word for you and add the quotes and the comma. The $1 is a RegEx variable that has a value of the results it found. $1 means the first result from your RegEx search.
Hope this helps