Hello, so I am going to ask for some probably obvious questions.
What do all of these %d or %a mean when used in these repeating syntax formats?:
Date.Offset:match('^([^%d]-)(%d+)[^%d]-(%d%d)')
local MatchTime = '%a%a%a (%d+) (%a%a%a) (%d+) at (%d+)%:(%d+)(%a%a)'
I know alone each one is %d Day of month as number, zero padded (01 - 31), and %a Abbreviated weekday name.
Certainly the actual meaning of the above is different? Or what do they do and mean?
It is currently May 29th, 2023, 2:03 am
Syntax Question %d so many of these - what do they mean in this snippet?
-
- Posts: 1177
- Joined: September 7th, 2020, 2:24 pm
- Location: QLD, Australia
Syntax Question %d so many of these - what do they mean in this snippet?
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
-
- Developer
- Posts: 22570
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Syntax Question %d so many of these - what do they mean in this snippet?
Those codes don't have anything to do with dates or times as such. They are codes used for "pattern matching" in Lua. Pattern matching is similar, although not identical, to regular expression.
The codes mean:
https://riptutorial.com/lua/example/20315/lua-pattern-matching
The codes mean:
Code: Select all
. all characters
%a letters
%c control characters
%d digits
%l lower case letters
%p punctuation characters
%s space characters
%u upper case letters
%w alphanumeric characters
%x hexadecimal digits
%z the character with representation 0