Got a validation error (pattern) since I update to 3.3.1 (from 3.1.1)

The panel output me this error when I tried to save an existing page:
preg_match(): Unknown modifier '^'

Didn’t have that error before. I tried other pattern that may achieved what I want but still have an error (different depending on which regex I use indeed).

Here’s my field:

	section_handle:
		label:
			en: Section ID
			fr: ID de la section
		type: text
		width: 1/2
		pattern: "/^[a-z0-9]+(?:-[a-z0-9]+)*$/"
		help:
			en: "Your unique section ID for identification or scrolling anchor purpose. Format : my-section-name"
			fr: "L’identifiant unique de votre section à des fins d’identification ou de défilement. Format : mom-nom-de-section"

Is there any change since the latest version ? Can’t find any notice about that on the doc.

Thanks!

Seems to work if you remove the slashes…

pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$"

  1. a-z0-9 ↩︎

Yes it works fine, thank you.

The fact that a regular regex did’nt work anymore should be written in the docs (and the code snippets should be updated in the documentation).

Yes, I was going to add a note about that.

Reopen the topic.

The same pattern (that did work before the update), edit with the Solution pattern still not working in a structure field.

When I click to add a new entry, I got a negative error in the panel “Cannot read property ‘length’ of null” where the handle field is supposed to be. Gif preview

Here’s my structure field:

			site_colors:
				label:
					en: Site Colors
					fr: Couleurs du site
				type: structure
				width: 1/2
				translate: false
				empty:
					en: No color yet
					fr: Pas encore de couleur
				fields:

					autoid:
						type: hidden
						translate: false

					name:
						label:
							en: Name
							fr: Nom
						type: text
						width: 1/3

					handle:
						label:
							en: Handle
							fr: Identifiant
						type: text
						width: 1/3
						pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$"
						help:
							en: "Format: my-color"
							fr: "Format : ma-couleur"

					color:
						label:
							en: Color
							fr: Couleur
						type: color
						width: 1/3
						editableAlpha: false
						default: "#FFFFFF"

Hm, could you create an issue on GitHub, please?

Done!