Reputation: 4919
This is continuation of my previous question: Parse text file with regex, but because I'm creating new expression I don't want to edit that question.
Thanks to Jerry I'm able to find matches but I need to get more complex.
Classes in ExtJS can have requires and mixins section:
Ext.define('Ext.Window', {
extend: 'Ext.Panel',
requires: ['Ext.util.MixedCollection', 'Ext.util.BasicDrag'],
mixins: {
draggable: 'Ext.util.Draggable',
droppable : 'Ext.utils.Droppable'
}
});
Thanks to previous question I'm able to get extend
part, but from above example I would like to get:
Ext.Panel
Ext.util.MixedCollection
Ext.util.BasicDrag
Ext.util.Draggable
Ext.utils.Droppable
Can this all be done using single RegEx? Or maybe 3 different RegEx'es (one from Jerry's answer)
requires section can look as so:
requires: 'Ext.util.MixedCollection'
or
requires: ['Ext.util.MixedCollection', 'Ext.util.BasicDrag'],
or
requires: [
'Ext.util.MixedCollection',
'Ext.util.BasicDrag'
],
the same with mixins.
Idea behind this is to get all dependencies and build custom minified JS file (I'm aware of Sencha CMD Tool)
I'm able to get single requires
but I can't get multiple elements to match. My started regex: http://regexr.com?36hto
Upvotes: 1
Views: 141
Reputation: 993
Like this?
requires\s*:\s*(?:\[)?\s*(?:(?:'([^']+)')(?:,\s*)?)+\s*(?:\],?)?
EDIT
requires\s*:\s*(?:\[)?\s*(?:(?:'(?<inside>[a-zA-Z.]*)')(?:,\s*)?)+\s*(?:\],?)?
That seems to be what you want for named matched
Upvotes: 2