File type validation with regex

Hi All,

 

I can't seem to get the validation working correctly on a file field.

I have two fields:

1. a written which should only accept the field type .doc or .docx

2. A video field I am trying to restrict the values to .mp4 / .mov / .avi

When using multiple file type validations or multiple whens they seem to cancel each other out.

 

I have tried adding the validation "file type is"

1. doc - This rejects anything that does not start as doc but it also accepts docy

2. [doc] - this works for .doc but nothing else

3. docx? - this does not work at all

4. [doc]x? - this does not work at all

5. doc|docx   - this does not work at all

6. /doc|docx/  - this does not work at all

7. docx?$ - - this does not work at all

 

I have not event tried the video field since I can't get the document field to validate correctly. Any tips for regex in knack? 

 

Edit: I wrote "file type is not" instead of "file type is"

Paul,

That's exactly what that does above..  If they file is not a doc and it's not a docx output the message.. You have to do it this way because you can't do OR's.. 

 

Hi Julian,

Thanks for the reply. I would like the field to only accept the field type .doc or .docx

In you're validation of the File type use 

file type is not doc

file type is not docx

 

![](upload://jwxMcop4dww3JLR7x8Kl03pYWuo.png)

Julian