• Resolved wilfried1954

    (@wilfried1954)


    Hello,

    I have a field that is used as a filename. What I like to do is that a user only can type characters that are permitted in a filename for unix, mac, linux.

    What’s the best method to do this? Can you advice?

    Thank you, Wilfried

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @wilfried1954

    If you are using a “Single Line Text” field, you should to enter the regular expression to use for validation into the “Validate against a regular expression” attribute, and the error text to display if the validation fails into the attribute: “Error message when the regular expression fails”

    In the following screenshot the regular expression validate the field’s values be digits only:

    Best regards.

    Thread Starter wilfried1954

    (@wilfried1954)

    Thank you!

    Possible it benefit for others. So I put my solution here. This is the Regular expression needed for filenames in Windows. I still have to expand it a little for Linux, but as the limits are the most big for Windows, this should do at least for Windows users:

    ^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\";|/]+$

    Best regards, Wilfried

    • This reply was modified 4 years, 2 months ago by wilfried1954.
    Plugin Author codepeople

    (@codepeople)

    Hello @wilfried1954

    Thank you very much for sharing your regular expression.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘disallow input of certain characters in a field’ is closed to new replies.