I tried playing the game 'Regex Hunting' to subdue monsters using regular expressions



A game ' Regex Hunting ' that allows you to enjoy learning ' regular expressions ' that can express a character string containing various elements with one character string has appeared, so I actually played it.

Regex Hunting

https://www.regex-hunting.com/

After accessing the site, click 'Start'.



Then you will scroll to the bottom of the site and you will see 3 types of quests. First, click 'Start' in the beginner's edition.



Before starting the game, you can check the explanation of the regular expression on the slide, so click the triangle icon at the bottom right or press the right key of the cursor.



An example of the explanation is 'character class'. When written as [acz #], it matches any one of 'a', 'c', 'z', and '#'. If the alphabet seems to be continuous, [az] will match lowercase letters a to z, and [BX] will match uppercase letters B to X. There is a tutorial that is easy to understand even for regular expression beginners.



The basic rule of the game itself is to enter the correct regular expression within the time limit, attack the enemy, and set the HP of the monster to 0 to clear it. Click 'Start Game' to start.



Since HP and the character string are displayed under the monster that appeared, enter a regular expression that matches and press enter.



The string with the light blue highlight is a match. With a successful attack, I was able to damage the monster.



An example that was not damaged. The problem is 'Enter a regular expression that matches cat, can, cad', but 'car' also matches.



I re-entered it so that it did not include the unnecessary 'car' and damaged the monster.



Defeated safely. Click 'Confirm Answer' to see an example of the correct answer and an explanation.



If you repeat it, you can become a regular expression master ...



The place where I actually play is like this.

I played 'Regex Hunting' where you can learn regular expressions while playing-YouTube


If you log in and play, the play time, the number of clears, and the fastest time will be recorded, and the ranking function will be available, and you can get the title if you meet the conditions.

According to the developer, Yuki Haga, this game was created to make people think 'regular expressions are interesting!', And if you want to study more regular expressions, the book ' Detailed Regular Expressions ' is recommended.

[Personal development] Would you like to go hunting to learn regular expressions? I made a game 'Regex Hunting' where you can learn regular expressions while defeating monsters --Qiita
https://qiita.com/yukiHaga/items/8ef2051036e126eb00c6

in Review,   Video,   Game, Posted by logc_nt