tiny-regex-c icon indicating copy to clipboard operation
tiny-regex-c copied to clipboard

Does not work for GUUID validation

Open tawmoto opened this issue 6 years ago • 3 comments

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

tawmoto avatar Jan 03 '19 14:01 tawmoto

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.

ToriningenGames avatar May 05 '20 02:05 ToriningenGames

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

monolifed avatar May 05 '20 10:05 monolifed

My times branch also supports this.

rurban avatar Jun 20 '22 05:06 rurban