|Machine Learning Lab's Regular Expression Game|
|Written by Nikos Vaggalis|
|Wednesday, 30 March 2016|
Machine Learning Lab has created a game that puts your regular expression skills to the test.
The game comprises of 12 levels of increasing difficulty, with each level containing a different block of text, which in turn contains the parts of the text that must be matched against a regular expression - which has to supplied by the user.
Each attempt is timed and rated in a 'F-measure' scale that
Before the game begins you complete a simple questionnaire where you have to tick the boxes adjacent to the regular expression constructs you are familiar with.
The constructs are grouped by relevance, so for example, the Character classes group includes expressions such as:
Groups & Lookarounds has, among others:
(click in image to enlarge)
This gives the sense that the test to follow will be adjusted to the level of experience determined through the questionnaire, but the exercises remain the same whether you tick all or none of the checkboxes. You can also navigate from task to task with no limitations as well as retake as many as you like.
The text to be matched comes pre-marked with a bold style so that it stands out from the rest of the text. What is very helpful is the immediate visual feedback you get as you type the characters forming the regular expression, because you get to observe what text they've matched thus far, therefore getting progressively closer to the complete match by means of trial and error.
Level 1 starts out easy, asking you to match the digits in bold from the following block of text :
We have to extract these numbers 12, 47, 48
Level 2 is more challenging as you have to match MAC addresses such as 38:f8:b7:90:45:92
At Level 5 you are asked to match IP's such as 18.104.22.168 while at Level 6 you encounter links, for example:
The difficulty increases until Level 12 where you have to match authors' names in the form of Lovecraft, H.P. or Duncan, R.
Take heed, however, the exercises are not as easy as they seem and require a good amount of time to master them all. The solutions to the problems are not supplied so if you get stuck there is no one to help. Or is there?
Look no further than Machine Learning Lab's own Genetic Regex Generator++ of course! Start by copying the whole exercise block of text, then paste it into the Generator's form field and then from within that field highlight the text that needs to be extracted.After that just let the machine find the right regex for you, thus beating them in their own game!
In the end what this entertaining game offers is a testbed for your skills and an attempt to educate yourself in finding new expressions of matching text.
I have a suggestion for the game makers. It would be great if they could gamify it even more by optionally requiring users to log in with a username and a password, sharing their F-measure and time taken to complete the exercises, thus enabling the platform to host competitions, league tables, top 10's of regex competence.
For a more advanced game, make sure you check Can You Do The Regular Expression Crossword?
or email your comment to: firstname.lastname@example.org
|Last Updated ( Wednesday, 30 March 2016 )|