Parseur now shows you predefined constraints in the "Advanced Options" section when editing a field in the template editor.
What are field constraints?
Constraints allow you to add additional matching constraints on a template field. This can be useful in case you have several templates that can match a single document. By default, Parseur chooses the template yielding the most number of fields. But, in some situations, it may not be the behavior you desire. Using constraints allow you to further refine how Parseur picks the matching template.
How to use field constraints?
To set a field constraint, open a template, edit a field and you'll find the constraint field in the Advanced Option section.
Until today, constraint was a free-text input accepting regular expressions. Regular expressions are powerful but notoriously complex to handle and hard to read.
With today's update, Parseur lists a pre-defined set of most commonly used constraints:
- None: anything can be accepted in the field, including portions of HTML formatting
- Text only: only text is accepted, no HTML
- Exact match: the field has to match exactly the value in the initial document used to create the template
- Custom: enter your custom regular expression
When selecting one of the predefined values, Parseur automatically updates the corresponding regular expression constraint field.