du-it
3 years agoNew Contributor
Conditionals are not supported in this regex dialect.
I have this regex evolved on http://www.regex101.com and it seems to work properly.
When I copy this regex into the OpenApi @Pattern annotation in a Spring Boot 2.5.4 application with springdoc-openapi (tried v1.4.8 and v1.6.1, supporting OpenApi v3) I get the message
Spoiler
Conditionals are not supported in this regex dialect.
This is the regex:
^XXX_(?:(?<DT>A12|B43|D14))?(?(DT)(_\d{5}_\d{1,3})|(?!(?&DT))(?!.*_\d{3}(?!\d))).*\.ZZZ$
What is the name of the dialect used by OpenApi?
Is it possible to tell OpenApi to use another dialect??
How can I modify the regex to meet OpenApi's requirements/to use the proper dialect?