I'm using Ext.js for filemanager. I'm trying to allow saving only .c and .cpp files. But I cant get both file extensions to work.
Ext.ns('Editor.FileCombo');
Editor.VTypes = Ext.form.field.VTypes;
Ext.apply(Ext.form.field.VTypes, {Expression
fileNameExp: /^(?!main\.c$)([a-zA-z]+[\w-]*\.c)$/i, // Expression
fileName: function(val,field){ // Test
return this.fileNameExp.test(val);
},
fileNameText: 'The filename ist not in a valid format!<br />Filename has to end with \'.c\' Or \'.cpp\,<br />Allowed: a-z,A-Z,0-9,_,- <br />Filename <i>main.c</i> is reserved for the compiler.', // Error QTIP Text
fileNameMask: /[\w\d-\.]/i // valid character Mask
});
Tried to modify fileNameExp to this:
fileNameExp: /^(?!main\.c$)([a-zA-z]+[\w-]*\.c)$([a-zA-z]+[\w-]*\.cpp)/i
But thats not working.. .I look around the Stackoverflow about this topic, but couldn't understand how to archive this. I would be very much appreciated if someone can fix this expression code!