I'm using gatsby and using gatsby-starter-netlify-cms
and I'm trying to add validation for the number of characters in the widget string
I have read in the docs that we can use pattern with regex to implements the validation
and here you can see how they use it
fields:
  - label: "Title"
    name: "title"
    widget: "string"
    pattern: ['.{20,}', "Must have at least 20 characters"] // this using regex
  - {label: "Layout", name: "layout", widget: "hidden", default: "blog"}
  - {label: "Featured Image", name: "thumbnail", widget: "image", required: false}
  - {label: "Body", name: "body", widget: "markdown"}
    comment: 'This is a multiline\ncomment'
so I tried to do this
    pattern: ['.{20,50}', "Must have 20 - 50 characters"]
then tried to do this
widget: "string", pattern: ['^[\s\S]{20,50}$', "Page Title should be 20-50 characters"]
any help would be appreciated
 
    