I need to reorganize an archaic cvs database so that it can be imported into ecommerce software with the correct special field names.
Here is some code I was matching against.
[id,category,manufacturers,model]
"1","3","Samsung","Galaxy S III"
"2","3","HTC","One X"
My regex
".*?".*?".*?".*?(".*?")
I basically need to replace only the manufacturer with a slightly more complex object literal like
{manufacturers: 'Samsung'}
but I can’t seem to figure out how to selectively replace the third match.
I know I can split the string and extract the data I need, but I don’t know how to replace the match so that the output variable looks like:
"1","3",{manufacturers: 'Samsung'},"Galaxy S III"
"2","3",{manufacturers: 'HTC'},"One X"
Thanks for helping me!
Match this:
Replace by this:
Example:
Output: