Hi, Xinglu Chen writes: > Any trick you used to find all of there weird version numbers? :-) This monstrosity: rg -U -B4 --pcre2 '(?!\(let.*(\n.*){0,1})\(version "([^\n"]*[^0-9\.][^"\n]*)".*(\n.*){0,10}commit.*version' gnu/packages and to show just the versions: rg -Uor '$2' --pcre2 --no-filename --no-line-number >> IMO, just get rid of the delimiter. If we wanted to be *that* flexible, >> we could make it so they provide a tag->version proc instead of (prefix, >> suffix, delimiter). > > a ‘tag->version’ procedure would probably make things a bit too > complicated for the people writing package definitions. For example, > having a delimiter would make it easy to match a tag like > “2021-01-01-release” > > Delimiter is “.” (sorry if this hurts your eyes ;-)) > > scheme@(guile-user)> (match:substring (string-match "^[^0-9]*([^\\.[:punct:]]+(\\.[^\\.[:punct:]]+)*).*$" "2021-01-01-release") 1) > $28 = "2021" > > Delimiter is “-” > > scheme@(guile-user)> (match:substring (string-match "^[^0-9]*([^-[:punct:]]+(-[^-[:punct:]]+)*).*$" "2021-01-01-release") 1) > $29 = "2021-01-01-release" > > And then, setting the suffix to “-release” would match just the version > part. Right. I missed that. In that vein, should we keep the dashes in "2021-01-01" or convert them to periods? What about when a tag has underscores? What if a repo has tags in both formats? Then "3.0.1" would be considered older than "2011-01-01". Maybe we should just add an extra bit to detect a date format and only consider it when there's no "proper versions"? Aaaand I fell down a rabbit hole after that :) I've attached a patch with what I've done. It still has lots of issues--it requires the tag to contain at least one version delimiter, it requires the first character of the version to be a number... it might not even be better than before I touched it, and even so the added complexity might not be worth it. But if you'd like to take it for a spin, I've attached it (it applies straight on master). -- Sarah