normalise regex in irl human conversation
seen from United States

seen from China
seen from United States
seen from United States
seen from United States

seen from Brazil
seen from China

seen from United States
seen from T1
seen from United States

seen from Malaysia
seen from United States
seen from United States
seen from Japan

seen from United States
seen from Lithuania

seen from T1

seen from T1

seen from T1
seen from Cambodia
normalise regex in irl human conversation
when you write a really long spreadsheet formula and/or regular expression that solves all your problems 🥴🥴🥴
heartbreaking: girl writes [a-z1-9] in her regex instead of [a-z0-9], spends half an hour debugging the program that mysteriously broke at the 10th element
The plural of regex is regrets 😂
look at some point we have to consider the possibility the regex people are just punking us and those expressions do nothing at all. what if they just type a random keysmash, do whatever thing they wanted the expression to do manually and then just pretend its the expression that did it.
Who up regularising they expressions
For the Love of God, Learn REGEX
I'm browsing through reddit and see this:
In the comments are many, many developers complaining about how hard this is to understand. This is nonsense. This code is a regex, and if you don't understand it, now is the time to learn! Regex is a very simple tool for parsing strings. It's easy to learn and is supported by almost all other coding languages. Ready? Its only aboiut 300 words, lets go.
Basics
A full regex looks like this: /^(foo)+$/gi It has forward slashes in front of and behind the 'matchers', which are the shorthand characters used to find things within a string. behind the forward slashes are the flags, which tell the regex basic rules for how to use the matchers.
Flags put on the end of a regex to tell it how to parse a string
i --- ignore case g --- search globally (don't stop after first match) m --- is multiline (doesn't stop at a newline character)
there are more flags but I've never needed to use them, and I've done complicated as shit things with regexs.
Matchers matches characters or positions.
^ --- start of string $ ---- end of string [] ---- any of the characters in between the brackets [^] -- none of the characters in between the brackets . -- any character x|y --- x or y \ --- escapes the character ahead of it you can also just type in a string literal e.g. /foo/ will find any instances of foo
Amounts how many times a matcher must appear
goes after a matcher or capture group e.g. (foo){2} will match "foofoo" but not "foo"
* --- 0 or more + --- 1 or more ? ---- 0 or 1 {n} --- exactly n {n,} --- n or more {n,m} - between n and m
Capture groups group together (and return) a set of matchers
Useful for: - snipping out only part of a string while matching against a larger sequence - group a bunch of different cases together - readability.
() is a capture group. everything inside is treated as one big block. (?: ) is a group that you don't want to capture, but still want to match
Advanced matchers shortcuts for common sets of characters
some ranges of strings are used so often there are shortcuts for them you never have to use a shortcut if you don't want to but you'll see them everywhere. \d --- matches digits zero to 9 (full would be [0-9]) \D --- matches anything NOT a digit (full would be [^0-9]) \w --- matches any 'word' (letters/digits/underscores) (full would be [a-zA-Z0-9_]) \W --- matches anything NOT a word \s --- matches any whitespace \S --- matches anything NOT a whitespace All done! See how simple that was?
There are multiple sites to help you write, test, and understand regexs. my favorite is https://regexr.com/, which includes a cheatsheet for quick reference. You can even type in an existing regex (like the scary one in the above image) and it will break down what each thing is doing. I've done that for you so you can see for yourself. You can even enter strings to test your regex against, just add the multiline flag and you can do multiple variants at once. Parsing strings without knowing Regex is like navigating a city while only taking right turns. Sure you can get most places you want to go, but why would you waste your fucking time doing that, and eventually, you will come up against a 'no right turn' street and you will be fucked. It's a critical tool and no programmer should be without it. The best case for learning regex is that regex is implemented in all major IDEs for find and replace functions. With regex, you can very precisely find and/or replace things, saving you literal hours or days of work. Another good example is trying to evaluate a user input in Javascript, for an input you only want to be numbers. Doing that without regexs means multiple steps, interacting with JSs goofy NaN methods, and ultimately still missing out on edge cases. Meanwhile the regex is a whole five characters -- ^\d+$, (seven if you include the forward slashes) and youre done. Regex is a shortcut, a way to be lazy, not a scary problem to solve.
Do not let yourself be intimidated by Regexs. Do not believe the things other devs tell you about how hard regexs are. Regexs are your friend. They save you time, energy, and in most cases are incredibly simple. Like other code, read and write them by breaking them down into smaller chunks and building that back up iteratively. You can do it!!
some kind of day at the codeblr discord server
@orthogonal-slut @b8horpet @moose-mousse
the full series