Using Regex on a Text Field

Hello everyone.

I’m trying to add regex to a text field to limit only lowercase characters and hyphens for URL slugs.

I’ve tried setting it in the field’s Meta:

{
  pattern: '^[a-z]+(-[a-z]+)*$',
}

And also tried setting it in the field’s Options JSON:

{
  multiline: false,
  showCount: true,
  readonly: false,
  placeholder: null,
  minlength: null,
  maxlength: null,
  list: [],
  pattern: '^[a-z]+(-[a-z]+)*$',
}

However, neither seems to work. I looked through all the documentation and couldn’t find anything, or any posts on here about this, so any advice would be much appreciated.