I'm trying to create a Lua pattern that will help me retrieve a version number inside a docblock or similar multiline string/comment.
Right now this is how it looks:
s = [[/**
* Let's pretend this is a random docblock...
*
* Very special line, super cool. Does many things.
*
* @version: 1.2.3
* @author: Unknown
*/]]
local match = string.match(s, "@version%p%s%d%p%d")
print(match)
Running this code yields:
@version: 1.2
What I really want is a pattern that will match any common version numbering and this is where I hit a brick wall since Regex and Lua patterns is something I simply never seem to learn. Is this possible with Lua patterns and the string.match function?
(Will be forever in your debt if you have a "dummies guide to patterns/regex")
@version%p%s+[^\n]+.