Post AQ6ds44PiMJu4P1L8q by benjaminhollon@fosstodon.org
(DIR) More posts by benjaminhollon@fosstodon.org
(DIR) Post #AQ6drzxB1K9dInbVJ2 by marcxjo@fosstodon.org
2022-11-29T03:45:11Z
0 likes, 0 repeats
Neovim wants me to believe my fingers are dumb.
(DIR) Post #AQ6ds0aWf1d7Gq0vdg by benjaminhollon@fosstodon.org
2022-11-29T03:48:56Z
0 likes, 0 repeats
@marcxjoGo trade those store-brand, mediocre "fingers" in for the REAL deal! Available now, call (444) 444-4444.
(DIR) Post #AQ6ds14IsJRulBwi3M by marcxjo@fosstodon.org
2022-11-29T03:50:05Z
0 likes, 0 repeats
@benjaminhollon Can't I just mash the keypad? :blobcatsadlife:
(DIR) Post #AQ6ds1UBK69K3S3NOC by benjaminhollon@fosstodon.org
2022-11-29T03:52:42Z
0 likes, 0 repeats
@marcxjoYou can, but only if you're willing to settle for as;ldhgpad;agfhs;dlkgha; sldfng;alsd. *Are* you willing to settle for that? *insert passive aggressive stare*
(DIR) Post #AQ6ds20nMqElgbJQDw by marcxjo@fosstodon.org
2022-11-29T03:55:25Z
0 likes, 0 repeats
@benjaminhollon/looks at worn-down finger nubs/looks at number 4 on phone keypadUgh. It's... only one number... :blobcatnervous:
(DIR) Post #AQ6ds2axCPA1UkEIaG by benjaminhollon@fosstodon.org
2022-11-29T04:04:22Z
0 likes, 0 repeats
@marcxjoKeep in mind I lived my last six years in a culture with heavily chinese influence, where 4 is a very bad number. ;)Also you're supposed to type it "i(4<Esc>vy2pa) <Esc>3pa-<Esc>4p" , 20 keystrokes, even though you could do "i(444) 444-4444<Esc>", 16 characters, because anything else proves how much you really need our product!(Okay, you could also do "i(444) <Esc>F4vy$7p3hi-<Esc>", also 20 keystrokes)
(DIR) Post #AQ6ds33fTe84vnfELA by benjaminhollon@fosstodon.org
2022-11-29T04:08:42Z
0 likes, 0 repeats
@marcxjoI feel like I should cc @RL_Dane on this by way of apology; that was a way worse set of keystrokes than his bash one-liners that I complain about. XD
(DIR) Post #AQ6ds3WjjZNiNxGReK by RL_Dane@fosstodon.org
2022-11-29T04:10:18Z
0 likes, 0 repeats
@benjaminhollon @marcxjoWhat dark magic is this?!That makes regex look like Hemingway!! :D
(DIR) Post #AQ6ds44PiMJu4P1L8q by benjaminhollon@fosstodon.org
2022-11-29T04:11:40Z
0 likes, 0 repeats
@RL_Dane @marcxjoLook, when I "learn" vim, I'm really running myself through an insane amount of convoluted logic that noone should ever be exposed to. Here you're seeing me harness that for humorous purposes. ;)Honestly that was such a fun message to right. Maybe I *should* take a stab at regex after all! Just think what horrors I could wreak!
(DIR) Post #AQ6ds4Dz8lyaY5Uz3o by benjaminhollon@fosstodon.org
2022-11-29T04:07:43Z
0 likes, 0 repeats
@marcxjoOkay, I just want to break character to say that I'm actually super proud of this reply. XD
(DIR) Post #AQ6ds4SsFPszIGSsGe by RL_Dane@fosstodon.org
2022-11-29T11:07:08Z
0 likes, 0 repeats
@benjaminhollon @marcxjoRegex is really quite decent, but definitely an acquired taste.I particularly like #regex in #perl, because #PCRE (Perl-Compatible Regular Expressions) are super powerful, mostly instead of needing to use large character classes like [[:alnum:]], [[:space:]] and [0-9], you can just write \w, \s, and \d, respectively. There's also the massively powerful \b, which represents a word border....
(DIR) Post #AQ6ds56Zrne3HP2a9Y by sotolf@social.linux.pizza
2022-11-29T11:22:44Z
0 likes, 0 repeats
@RL_Dane @benjaminhollon @marcxjo I think I've mostly been using languages including pcre, so I have all of those things available as well, then again I'm basically using perl for my regexes :p
(DIR) Post #AQ6ds5cTxBAKsLy3sm by RL_Dane@fosstodon.org
2022-11-29T11:48:02Z
0 likes, 0 repeats
@sotolf @benjaminhollon @marcxjoIf the syntax is pretty fluid, then yes.I find python's regex syntax a bit stiff.
(DIR) Post #AQ6ds64qFjqoIJEi5Q by sotolf@social.linux.pizza
2022-11-29T11:50:51Z
0 likes, 0 repeats
@RL_Dane @benjaminhollon @marcxjo https://nim-lang.org/docs/re.htmlit seems it says so exactly on the top :p always have felt pretty fluent to me :)
(DIR) Post #AQ6ds6Cdmk5agUswF6 by RL_Dane@fosstodon.org
2022-11-29T11:12:46Z
0 likes, 0 repeats
@benjaminhollon @marcxjo...E.g., \brom\b would exactly match the word "rom" in any sentence, and not "from." That's much harder to do in conventional regex.The other helpful thing about having regex as a first-class citizen in your programming language is that you can build up very complex expressions with several variables for readability, something like:...
(DIR) Post #AQ6ds6a2Nknvr3pci8 by RL_Dane@fosstodon.org
2022-11-29T12:14:27Z
0 likes, 0 repeats
@sotolf @benjaminhollon @marcxjoNot bad. The syntax is quite decent. Different, but easy to understand.Python has the bizarre foo = re.compile('regex') syntax.Which isn't *horrible*, but it isn't as nice as Perl's.
(DIR) Post #AQ6ds6zupXVL9JwI2y by leviramsey@social.vivaldi.net
2022-11-29T18:19:27Z
0 likes, 0 repeats
@RL_Dane @sotolf @benjaminhollon @marcxjo Scala's is nice:"""\brom\b""".r.unanchored is effectively the same (if I remember my Perl right) as qr/\brom\b/.
(DIR) Post #AQ6ds7WAtbJClN23KS by sotolf@social.linux.pizza
2022-11-29T18:43:36Z
0 likes, 0 repeats
@leviramsey @RL_Dane @benjaminhollon @marcxjo why the 100 "s?
(DIR) Post #AQ6ds7wPK4IC4jJ0DY by leviramsey@social.vivaldi.net
2022-11-29T18:52:00Z
0 likes, 0 repeats
@sotolf @RL_Dane @benjaminhollon @marcxjo triple quote means not having to escape backslashes in the string.
(DIR) Post #AQ6ds81j0IXuLDnFVQ by RL_Dane@fosstodon.org
2022-11-29T11:13:21Z
0 likes, 0 repeats
@benjaminhollon @marcxjo...my $verbsRegex = "(open|close|modify)";my $objectsRegex = "(file|namespace|pipe|(char|block)dev)";if ( $line =~ /$verbsRegex.*$objectsRegex" ) {(my Perl is rusty, I might not have the syntax down perfectly)
(DIR) Post #AQ6ds8SfO863gmOlV2 by sotolf@social.linux.pizza
2022-11-29T18:53:50Z
0 likes, 0 repeats
@leviramsey @RL_Dane @benjaminhollon @marcxjo that's quite noisy, not a big fan of that.
(DIR) Post #AQ6ds913KHbPPQUE64 by leviramsey@social.vivaldi.net
2022-11-29T18:57:01Z
0 likes, 0 repeats
@sotolf @RL_Dane @benjaminhollon @marcxjo It's not really different from what Nim has to do with r"".
(DIR) Post #AQ6ds9ogLlIjtLhrSC by sotolf@social.linux.pizza
2022-11-29T18:58:10Z
0 likes, 0 repeats
@leviramsey @RL_Dane @benjaminhollon @marcxjo that has nothing to do with escaping it's a function call to compile a regex, and it's half the amount of characters.
(DIR) Post #AQ6dsAI6aMpxMbTMJc by leviramsey@social.vivaldi.net
2022-11-29T19:08:00Z
0 likes, 0 repeats
@sotolf @RL_Dane @benjaminhollon @marcxjo r"" doesn't compile a regex (see https://nim-lang.org/docs/manual.html#lexical-analysis-raw-string-literals), just builds a raw-string, which a subsequent call compiles into a regex
(DIR) Post #AQ6dsAneh44ewSEYUa by sotolf@social.linux.pizza
2022-11-29T19:30:00Z
1 likes, 0 repeats
@leviramsey @RL_Dane @benjaminhollon @marcxjo gotta love people who don't bother actually reading the example and call you wrong when they have no idea of the thing just like the Americans coming telling me I'm wrong about my mother tongue, so wonderful, I love it so much...
(DIR) Post #AQ6dsAoMeQdoyeZ7b6 by leviramsey@social.vivaldi.net
2022-11-29T19:03:51Z
0 likes, 0 repeats
@sotolf @RL_Dane @benjaminhollon @marcxjo Where it gets really nice is with captures and general pattern matching:val Regex = """\bfoo=(\S+)\b""".r.unanchored"baz=qux foo=bar thingy=dingy" match { case Regex(foo) => println(s"foo is $foo") case _ => println("No foo :(")}
(DIR) Post #AQ6dsBrElEX8DquviK by leviramsey@social.vivaldi.net
2022-11-29T19:12:36Z
0 likes, 0 repeats
@sotolf @RL_Dane @benjaminhollon @marcxjo So the Nim equivalent to Scala's """\bfoo\b""".r.unanchored would be re(r"\bfoo\b") while the Nim equivalent to Scala's """foo.*bar""".r would be re(r"^foo.*bar$") AFAICT