mokkabonna / json-schema-merge-allof

Simplify your schema by combining allOf
97 stars 23 forks source link

Add support for merging patterns #2

Closed qzb closed 5 years ago

qzb commented 5 years ago

Despite of what README states, regular expressions can be merged using zero-length assertions: https://www.regular-expressions.info/lookaround.html

mokkabonna commented 5 years ago

Thanks!

mokkabonna commented 8 months ago

This turned out to not work as expected, see #44

For example this works as expected:

/(?=1)(?=\d)/.test('1') // true

This does not:

/(?=1)(?=2)/.test('12') // false

This however works as expected:

/(?=.*1)(?=.*2)/.test('12') // true