Regular Expression For Folder Name

3,723 views
Skip to first unread message

krishna shinde

unread,
Aug 20, 2010, 7:35:01 AM8/20/10
to flex_...@googlegroups.com
Hi All,

                  i want to validate the folder name when user create or rename a folder . for that i am using regular expression validator.
as per standards a folder name should not have this characters *   /   >  <  ?  \  | : , i am trying to generate regular expression for that but failed. If anyone have that expression or any new way for validation then please let me know.

Thanks 
Krishna

Abhinav Mehta

unread,
Aug 20, 2010, 8:51:28 AM8/20/10
to flex_...@googlegroups.com
Hello Krishna

For validating the folder names, you may use-
^([a-zA-Z0-9][^*/><?\|:]*)$

--
Abhinav Mehta


--
You received this message because you are subscribed to the Google Groups "Flex India Community" group.
To post to this group, send email to flex_...@googlegroups.com.
To unsubscribe from this group, send email to flex_india+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.



--
Regards
Abhinav Mehta
Developer | Blu
Bangalore | INDIA

Олег Галабурда

unread,
Aug 24, 2010, 4:54:20 AM8/24/10
to flex_...@googlegroups.com
Hi!

You are used wrong quantificator -- empty string will be valid folder name. :)
You may use {1,}

var regexp:RegExp;
var string:String;
regexp = /^[^\\\/:*?"<>|]{1,}$/g; // unicode folder name
string = 'EH\'46u4 6y4y6 ХШЩзшщртіЇ'; // valid unicode folder name
trace(string.match(regexp));
regexp = /^[\w\s ']{1,}$/g; // non-unicode folder name
string = 'EH\'46u4 6y4y6 ';
trace(string.match(regexp));

output:
EH'46u4 6y4y6 ХШЩзшщртіЇ
EH'46u4 6y4y6

> For validating the folder names, you may use-
> ^([a-zA-Z0-9][^*/><?\|:]*)$

--
Oleg Galaburda
http://blog.actualwave.com/
http://jsinterface.googlecode.com/
http://guibuilder.org/

krishna shinde

unread,
Aug 26, 2010, 8:45:37 AM8/26/10
to flex_...@googlegroups.com
Hi guys ,

      thanks for reply , i have tried both option but no one works.
what i exactly want is when user type folder name in textinput box , i want to restrict him so that user is not able to insert  *   /   >  <  ?  \  | : , character in textinput. for this i am using regular expression validator.


--
You received this message because you are subscribed to the Google Groups "Flex India Community" group.
To post to this group, send email to flex_...@googlegroups.com.
To unsubscribe from this group, send email to flex_india+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.




--
कृष्णा भगवानराव शिंदे
9028903199 

kannan r

unread,
Aug 27, 2010, 5:55:30 AM8/27/10
to flex_...@googlegroups.com
cant we use restrict here. Instead of validating later?
Reply all
Reply to author
Forward
0 new messages