Option to validate RegExp per line/per entire content

I have set up a modular block that should always be an unordered list. If the user puts in content that is not part of an unordered list, the module should not validate.

The RegEx pattern I have set is: /^(\*\s.+\n?)+$/

This pattern works well to validate using regexr.com, but in Dato it matches any line. For example:

Dato behavior:

* This validates
even though the second line is not a list item
This validates
* even though the first line is not a list item
This does not validate
because neither line is a list item

regexr.com behavior:

Which is behaving as expected

* This does not validate
because the second line is not a list item
This does not vaidate
* because the first line is not a list item
This does not validate
because neither line is a list item
* This does validate
* because both lines are list items

@clay thank you for reporting this.

Your expected behaviour is that we apply the RegEx line by line as opposed to the entire content of the text as a whole, right?

We might need to add an option for that, something like validate the entire text or validate one-line at the time. Do you agree?

@mat_jack1 Thank you for the reply.

I believe that my regex pattern should be looking for:

([asterisk character] [space] [1 or more characters] [0 or 1 new lines]) repeating 1 or more times

It looks like DatoCMS is currently only checking to see if that pattern validates anywhere within the multiline text?

Yes I think it would be a fantastic feature if we had the option check if all of the lines validate.

OK, I’m renaming/moving this into a feature request then :slight_smile: