dr.doom5771 | just got back to using raku after a long time say so "32.51" ~~ &number; # OUTPUT: «True» say so "15 + 4.5" ~~ /<number>\s* '+' \s*<number>/ # OUTPUT: «True» why are they using so here? | 06:16 | |
scullucs | Hmm... Where does "number" come from? | 06:33 | |
nahita3882 | (probably my regex number or similar) | 07:58 | |
they are using so to get a Boolean result out of the smartmatch: True if the regex match succeded, False otherwise | |||
if you don't so it, it will give you the resultant Match object (or Nil if no match) | 07:59 | ||
but sometimes you only care if it matches or not; not what part of the string matched etc. | |||
lizmat | if you're interested in speed and only *if* it matches, you can do .contains(/.../), which doesn't create a relatively expensive Match object | 08:29 | |
docs.raku.org/type/Str#method_contains | 08:30 | ||
15:05
lizmat_ joined
15:10
kjp_ joined
15:15
lizmat left,
kjp left
17:51
lizmat_ left,
lizmat joined
21:50
lizmat_ joined,
lizmat_ left
|