Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: The Typing of the RegEX (thetypingoftheregex.com)
60 points by workeffortwaste on Oct 26, 2022 | hide | past | favorite | 56 comments
I'm sorry/not sorry for creating this.


Could do with a bit more instruction and feedback to the user. A lot of the times, the blue highlighting seems to indicate I've matched all the necessary parts of the input, which should mean the puzzle is solved, but it's Game Over instead.

My most recent examplew was "It's alive! It's alive!" as input with all the non-space underlined, for which I wrote `/\S/g`. It seemed to match all the required parts, but the timer just counted down and ended with a Game Over. And there's no feedback on what exactly was wrong. (I encountered similarly confusing ones seven or eight times, so this isn't an isolated input for which this happens.)


> A lot of the times, the blue highlighting seems to indicate I've matched all the necessary parts of the input, which should mean the puzzle is solved, but it's Game Over instead.

You need to include punctuation for some regexes.

e.g.

   The brown fox.
             ^^^^
Would be matched with:

  /fox./


You have to be careful about escaping, in case you do not watch to match "foxy" as well.


If you are interested in Python regex, here's my tkinter app with 75 interactive exercises: https://github.com/learnbyexample/py_regular_expressions/tre...

This assumes you already know Python regex. If you'd like learn first, see my free ebook: https://learnbyexample.github.io/py_regular_expressions/


I've now made it clearer why /\S/g is different from /.*/

Try on the match start screen to see the different visual feedback between the two.


Fun idea, but pretty unfun to play. Half the questions are just five, six different words you need to `|` together, and not enough time to even type out that many words.

Feels like the author thinks regex is a useful way to match a bunch of unrelated words in a paragraph. Not really the point of regex.


I guess the goal should be to find a common property like /\w{5,6}/g matches all 5 and 6 letter words but not longer or shorter words.

But I agree the time is not a good measurement because typing speed is what limits most people.


Yeah I'm on mobile and can't see the text above while I type because of the space for the on screen keyboard and can't type fast enough anyways on mobile so just gave up instantly :)


Trying to play it on mobile! Okay that's something I hadn't expected.


I liked it. Thank you.

These are my 2 cents:

- The starting and ending / could be part of the mask, so the user don't need to type it.

- Some rules are not immediately clear. Eg. "The WORLD IS GOOD", should be /WORLD IS GOOD/ or /(WORLD|IS|GOOD)/ ? Or both?

- Add difficult levels. Maybe more time on easy mode.

- It's a nice learning environment. Let the user try to solve the puzzle when the time ends, just don't let him pass to the next level. Or maybe let him pass, but reset the score.


I had fun with this but I _really_ wanted a learning mode. I was more interested in solving the puzzle of the regex than maxing out my score. Maybe make a version where you can get maximum points for a period of time then the possible points starts to go down. You can still continue after it hits 0, you just won't get any points


I think you need the trailing slash so you can add the global flag?


You are right! I thought the game doesn't support flags. Maybe just the starting / could be part of the mask.


This is fun! Except I was almost immediately stymied by a question that asked me to match both "like" and "live". I put in `/li[kv]e/`, which was not accepted, but passes in every regex engine on regex101. I'm a bit confused. Is this a bug in the game or did I miss something in the question?


add a "g" after the last slash to make it a global search. (I didn't make the game, I'm figuring shit out too. All the same, I'm a regex ninja and the time allotted is far too low.


It doesn't seem to like regexes like /.*/ either, despite them matching the whole thing.


Is there any way to see what the expected regex was after failure? I feel like this could be a great review tool if that was added


Yes. One or two potential answers could be really helpful features.

It's too much to ask but I also wish to see recent submissions.


This would be a lot better if it didn't make me start and end every entry with / Also, the timer is way too short for anything more than a word or two. The third one is a whole bunch of words. That's too much.


> Also, the timer is way too short for anything more than a word or two. The third one is a whole bunch of words. That's too much.

Unless game objective is also to train typing, you are right.


I think that may be part of the inspiration, given the reference to "the typing of the dead" typing game


Loved this! Super fun, but the timer feels a bit fast sometimes and as far as I can tell the game will randomly give you anywhere from a very easy or quite difficult level at any point, so there doesn't feel to be a natural progression in difficulty as you start a new game and finish each level.


needs more clear instructions... Am I using capture groups? what is the goal?


You should have written:

/I'm (sorry|not sorry) for creating this/


/I'm (not )?sorry for creating this/


ah, better.


They should state very clearly what RexEx version/engine


It's likely using your browser's javascript regex engine


It's using the built in .match() to parse your answers.


Is this a bug? Matching both instance of "us!" in "One of us! One of us!" didn't work with either /us!/g or /\bus!/g. That said this rocks and I love it tysm.


Note for anyone who might have missed it like I did. Dark Reader makes the underlines not visible. Didn't know what I was doing at all until I disabled it.


Design-wise this is amazing. Typography, animations, just great taste all in all.


Thank you.


what are the / for?

I couldn't figure out how to get started until I read someone in the comments suggest to make them optional.


It's a traditional Regex syntax in several languages including JS (relevant here), Perl, and going way back to ancient Unix tools such as vi and ed.

The vi/ed form you often see in HN and other technical discussion memes too, such as:

s/easy/hard

Which is a joke to substitute uses of the word "easy" with "hard". The slashes mark a RegEx so you can get really clever in such jokes, though usually most such jokes are simple word substitutions.


How am I supposed to match two entirely different words? Atomic groups with | don't seem to work. Not something I'd use regex for anyway. What am I missing here?


/wordone|wordtwo/g

There's a video of it being played here: https://youtu.be/da0GyuwaY_Y


On older safaris, the background skewed svg doesn't display correctly (which would be a safari problem but there are plenty of ways to underline text without being too clever by half) so it's not clear what should be matched, particularly when it involves trailing punctuation.


Thanks for the heads up, I'll see what I can do.


have a untimed version too. also, typing // all the time is annoying, make it by default


I've added match boundary markers now so it should be clearer why your RegEX might not be right.

I've also enabled some of my debugging stuff in the console for those who want to dive deeper into expected outputs of certain puzzles.


I tried it on my phone and it looks like it could be fun. However the timer is too fast.


so frustrating you're not revealed the answer when you lose


Got 8250. At some point it just becomes a matter of "how many words can you type separated by |", IMO. The design is very aesthetically pleasing, too.


Doing that method disables the bonuses.

Getting bonuses means more points and more time added to the clock.


what are exclusion puzzles? the underline changes to be an outline, but i'm really not sure what to do. some help on the game would be helpful!


Every word but the marked words, you can see an example of one being solved in this video.

https://youtu.be/da0GyuwaY_Y


Video of it being played:

https://youtu.be/da0GyuwaY_Y


This is great. I would love it if it actually taught Regex for users that want to learn!


What syntax does it use? For example `|` doesn't seem to do anything.


Got it, it looks like sed-ish syntax. In the end it's a typing speed test.


If you simply brute force by typing the words exactly puzzles you won't get the bonuses.


You are pure, unadulterated eeeeeevil. Also, I am surprised at how many people are not getting the point of the game.

Edit: by the way, the colors in the page are wonderful. The font is pretty nice, too.


Perhaps enlighten us rubes with the "point"?


hurry up!

time based game over isn't a good idea.

good typer's are advantaged

insteed of that, distribute "try" token


Great visuals and sounds. I didn't understand the reference without the fellow HN commenter explaining it. Maybe you could focus the input box on startup and after Game over.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: