Hi guys, pattern matching is always a magic to me. I've wasted an hour on this issue, maybe you can solve faster:
given a string of the form:
number-spaces-number-spaces-number-optionalspaces-optionaltext(with possible spaces in it)
e.g.:
"100 100 60"
or
"60 250 80 this is it"
i want to extract the 3 numbers and the remainder as a string (or nil or "" it is is empty). what's the simplest way?
my best attempt so far:
string.match(text,"(%d*)%s*(%d*)%s*(%d*)%s?(.?*?)")) |
which returns the numbers and the first letter of the remaining text. i don't understand why not all the remaining text though.
(i need this to read files in the gpl format, aka gimp palette)
Comments
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Then after that you can do whatever you like with the values (fld[1], fld[2], ...).
Pattern: https://regex101.com/r/RpwwBv/1
Likes: MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: keszegh
if there is only 3 numbers:
Likes: keszegh
Fragmenter - animated loop machine and IKONOMIKON - the memory game