mw.fileTypes.filenameValidation Extension Point
You can add filename validations for different file types in MATLAB® using the mw.fileTypes.filenameValidation extension point.
Adding filename validation for a file type ensures that when a file of that type is created or
renamed, the filename is valid.
To add filename validations for file types in MATLAB:
Create a JSON-formatted file named
extensions.jsonand place it in a folder namedresources.Add a set of JSON declarations to
extensions.jsonthat defines one or more filename validations.Add the folder containing the
resourcesfolder with theextensions.jsonfile to the MATLAB path. To add the folder to the path, use theaddpathfunction or right-click the folder in the Files panel and select Add to Path > Selected Folders and Subfolders.
This JSON code shows the basic structure of the
mw.fileTypes.filenameValidation extension point.
{
"mw.fileTypes.filenameValidation": {
"groups.matlabCodeFiles": {
"errorRegexPatterns": [
{
"pattern": "/^.+$/;",
"flags": "ig",
"errorLabel": "Filename must not be empty"
}
],
"warningRegexPatterns": [
{
"pattern": "/^.{0,125}$",
"flags": "ig",
"warningLabel": "Filename is too long"
}
]
}
}
}For more information about using extension points, see Extend MATLAB Using Extension Points.
Properties
Version History
Introduced in R2025a