Net text with regex: 10 levels of anchors, quantifiers, groups and lookahead. The most practical regex game around. 10 levels, right in the browser.
A regular expression (regex) is a pattern for finding text. At Mr. Ujang’s fish pond the pattern is a net: every block you tap knots in one stretch, left to right. When the pond is let out, the fish swim to the net one at a time. A label that matches the pattern is held, and the part of it the net holds lights up. One that does not match goes through to the lower pond.
A character class [...] matches one character from the list inside it. [aiu] = one letter a, i, or u. [0-9] = one digit. Inside the brackets most symbols lose their special meaning: [.] is just a dot.
A quantifier says how many times what comes before it repeats: {3} exactly three times, {2,4} two to four times. An anchor takes no characters: ^ points at the start of the text, $ at its end.
A group ( ) binds several characters into one unit that can be repeated, and keeps the part it matched. In Mr. Ujang’s net a group is a pocket: the stretch between the two brackets bellies out and keeps what it catches.
Every knot so far comes together in one net. Remember the difference: . with no backslash = any character, \. = a dot only. It matters for emails, web addresses, and times.
dumbo, any other catfish just lele. Other fish go through.tok struck again and again. Hold the fish whose label has that beat, and the net must hold every stroke in a row. The net’s pocket keeps what it catches.@, domain, dot, ending (each part letters, digits, or underscores), and hold the address only. An unfinished one goes through.