# RFC: Making content expressions a regular language

**URL:** <https://discuss.prosemirror.net/t/rfc-making-content-expressions-a-regular-language/920>\
**Category:** Uncategorized\
**Created:** [August 5, 2017, 3:21pm UTC](https://discuss.prosemirror.net/t/rfc-making-content-expressions-a-regular-language/920 "2017-08-05T15:21:59Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [August 7, 2017, 9:29am UTC](https://discuss.prosemirror.net/t/rfc-making-content-expressions-a-regular-language/920/6 "2017-08-07T09:29:08Z")

</div>

I expect that removing the need to know about attributes (via [the other RFC](https://discuss.prosemirror.net/t/rfc-deprecating-prosemirror-schema-table-and-attribute-constraints-in-schemas/864)) will definitely introduce some opportunities for simplification, but nothing huge – the overall structure will remain similar.

I’ve also been considering whether this could be pluggable – if the interface is simple enough, people could provide their own content-validation implementations in cases where the default isn’t powerful enough. I could probably define a smaller minimal interface that an implementation has to implement, but some of the extra methods provide useful optimizations (for example, to get a match after a known-to-match fragment, if the content expression has only one state, we don’t have to play through it, we can just immediately return that state).

Something like the current [`ContentMatch`](http://prosemirror.net/docs/ref/#model.ContentMatch) class – a value encapsulating a match state – probably remains necessary. The interface you propose doesn’t really express what needs to be expressed – [adding a node](http://prosemirror.net/docs/ref/#model.ContentMatch.matchNode) to match creates a new match state (or a failure to match), rather than a boolean, and [filling](http://prosemirror.net/docs/ref/#model.ContentMatch.fillBefore) works in terms of fragments, not positions in a document.

---

_[View the full topic](https://discuss.prosemirror.net/t/rfc-making-content-expressions-a-regular-language/920)._
