ontodev / valve.rs

A lightweight validation engine written in rust.
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Improve handling of regex alternates with `match()` condition #89

Open jamesaoverton opened 4 months ago

jamesaoverton commented 4 months ago

Our match() condition doesn't seem to work as expected when regex alternates with | are used. I think it's because we naively wrap the argument of match() with ^ and $ anchors, here: https://github.com/ontodev/valve.rs/blob/main/src/toolkit.rs#L2740. So match(/\S|\S.*\S/) becomes ^\S|\S.*\S$. The workaround is to wrap in parentheses: match(/(\S|\S.*\S)/). Maybe we should wrap in parentheses at line 2740?

jamesaoverton commented 1 month ago

@lmcmicu Can you please give this some thought?