Regular expression for validating filename

Rated 4.42/5 based on 937 customer reviews

But I want to validate the whole file path, which contains '\' as file separator.

For that, do you suggest, I split my file Path String on '\' character and perform the check on each part or include '\' character in my regex expression?

The part where I seek your help is writing the regex expression: Point to note: The file Path is the path of the file plus the file name and extension.

Example: \prod1\customer1\title1\my And it can be any level deeper, so I have to validate the whole path and the file name.

WITH files AS ( select substr(file_name,(instr(file_name,'/',-1,1) 1),length(file_name)) base_filename FROM dba_data_files) select base_filename from files WHERE REGEXP_LIKE(base_filename,'^[^\\./:\*\?

I have looked on google where i found a couple but they didnt work. As far as I know, for Linux and most UNIXy OSes it's this: #[^/]# i.e.Hi, Im looking for a regular expression to check that a entered filename is valid.I have a cms Im building where the user can enter the name of a file, enter content and then click Save where the file is created on the server.metacharacter match anything INCLUDING line breaks. Java Script by default does not support this since the . This is the best solution and should work 99% of the time is. If you want to match an IP within a string, get rid of the leading ^ and trailing $ to use \b (word boundaries) instead. The regular expression is only useful to validate the format of the date as entered by a user.Consult this page for more details on this problem. For the actual date validity, you should rely on another language.

Leave a Reply