It's all about the answers!

Ask a question

regular expression to restrict changes by Item Name


Samira Bataouche (623) | asked Oct 24 '12, 6:07 a.m.
edited Oct 24 '12, 6:11 a.m.
I have a problem with a regular expression to not allow special characters in file names.

I used the following expression ^[_0-9a-zA-Z\.]+$ which allows alphabetical characters, numbers, '_' and '.'.  I don't allow '-' in files names.
 
The result is that It doens't allow the creation  of a file named xx&yy or xx-yy.
It also doesn't allow to rename a file xx&yy but renaming a file xx-yy works.

And I don't understand why :-( the character '-' is accepted when it is a rename operation.

Thanks for your help.

Samira

One answer



permanent link
Michele Pegoraro (1.8k14118103) | answered Oct 24 '12, 6:22 a.m.
Hi,
where do you put this regex? In an advisor? Of which operatation?

Michele.

Comments
Samira Bataouche commented Oct 24 '12, 8:13 a.m. | edited Oct 24 '12, 8:13 a.m.

in a precondition of a deliver




Samira Bataouche commented Oct 24 '12, 8:14 a.m. | edited Oct 24 '12, 8:15 a.m.

 with the following parameters of the expression




Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.