kokke / tiny-regex-c

Small portable regex in C
The Unlicense
1.22k stars 174 forks source link

Does not work for GUUID validation #27

Open tawmoto opened 5 years ago

tawmoto commented 5 years ago

Hello, it seems that it does not work for GUUID validation

const char* pattern = "^([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})$";
int m = re_match(pattern, "CA761232-ED42-11CE-BACD-00AA0057B223");

This works with online tools https://regex101.com/r/hD8sJ8/3

Thank you

ToriningenGames commented 4 years ago

Disclaimer: I am not the maintainer.

Your regex contains quantifiers ({8} etc.). Currently, they are not supported (ref. Issues #18, #29). For this reason, I'd expect your regex to fail. Issue #29 points to a fork that, while out of date, does support quantifiers. Or, while more tedious and harder to maintain, repeating the character group prior to the quantifier would work.

monolifed commented 4 years ago

It supports match length now. You can do it with a few matches

There is another fork that supports quantifiers: https://github.com/monolifed/tiny-regex-mod

rurban commented 2 years ago

My times branch also supports this.