I'm trying to write a regex matching every dependency for a angular 1.5 class. This is what I got so far:
\$inject = \[('([\w]+)'([,]?[\s]?))*
This is what is a couple of test lines:
MyController.$inject = ['service1', 'service2', 'service3'];
MyController
.$inject = [
'service1',
'service2',
'service3',
];
This should be the result:
match = ['service1', 'service2', 'service3'];
But my regex above will only fetch the last item: service3, and I don't know why. Can anybody help?
Update
Got it working here: http://regexr.com/3e6c2