Using the code below I am trying to set the maximum length of a meta description box to be 300.
No matter what I type into the box, it will also say it did not match the pattern.
I have tried quite a few different regex patterns and also made sure I wasn’t using new lines just incase the . didn’t match all etc.
Yes, the error will show if the pattern doesn’t match.
To be more precise the pattern should be pattern: ['^.{0,300}$', 'Must not exceed 300 characters']
I’ve tested this locally: