Hi,
while playing around with regexml, I've tried my hand at a few simple regular expression using the XML Schema 1.1 mode.
At least from my understanding of XML Schema 1.1 Regex, all expressions are anchored by default, but the following example does not work as I would expected, as it seems to be enough for a fragment of the input to match the regular expression.
fn main() {
let reg = regexml::Regex::xsd("[0-9]{4}", "").unwrap();
// must match
assert!(reg.is_match("1234"));
// must not match
assert!(!reg.is_match("abc1234def"));
}
Manually anchoring the expression, i.e. using ^[0-9]{4}$, makes even 1234 not match the regular expression, so that's probably not the right move. Not sure if I am maybe missing a flag, but from the ones I see I'm not certain they have an influence on this.
regexml version: 0.2.1
rust version: 1.85.1
Thanks for providing the library, I'm amazed that this topic is receiving attention in native Rust!
Hi,
while playing around with regexml, I've tried my hand at a few simple regular expression using the XML Schema 1.1 mode.
At least from my understanding of XML Schema 1.1 Regex, all expressions are anchored by default, but the following example does not work as I would expected, as it seems to be enough for a fragment of the input to match the regular expression.
Manually anchoring the expression, i.e. using
^[0-9]{4}$, makes even1234not match the regular expression, so that's probably not the right move. Not sure if I am maybe missing a flag, but from the ones I see I'm not certain they have an influence on this.regexml version: 0.2.1
rust version: 1.85.1
Thanks for providing the library, I'm amazed that this topic is receiving attention in native Rust!