Atom regex find and use value as replace value


Hi, how can i add extra string on the code? i want to achieve something like this

["zip_code"=>"29078", "city"=>"Lugoff", "county" => "Kershaw"],

these are the codes,

["zip_code"=>"29078", "city"=>"Lugoff", "Kershaw"],
["zip_code"=>"29079", "city"=>"Lydia", "Darlington"],
["zip_code"=>"29080", "city"=>"Lynchburg", "Lee"],

i use this regex to select the "Lugoff", ", now how can i add the "county"=> ??

“([a-z])+”, "


In the replace field, put "$1", "county"=>.


it’s not working, it just replaces the text literally as $i


The number 1.


yes, i meant’ $1 sorry,



Why did you delete the original regular expression? You can’t have a variable in the replace string with no capture group. If you find "([a-z])+", " and replace it with "$1", "county"=>, the capture group value will be retained.