Welcome to the 27th Beginners programming challenge.
Because I have a bit of free time, I decided to post this programming challenge early.
This means it will be a bit more complicated and will probably take more work to achieve.
You will have to implement a small regular expression engine that imitates a small subset of the Perl style regular expressions. It will only have to do matching, no need for replace or other complicated features.
You will then use it in a program that will take input and print the text that was first matched by the regular expression. Hopefully, this will introduce you to regular expressions and understand how such an engine works.
These are the operators you will have to implement: * . $ ^ ? +
and of course normal letters
Cookie points will be awarded for the following extras:
- Implementing the | (or) operator.
- Implementing character classes (annotated with ).
- Take input from stdin if a file is not supplied so piping is possible on the command line.
- Printing every match and not only the first one.
Any overly obfuscated code will be immediately disqualified without account for programmers skill. Please remember that these challenges are for beginners and therefore the code should be easily readable and well commented.
Any non-beginner entries will not be judged. Please use common sense when posting code examples. Please do not give beginners a copy paste solution before they have had a chance to try this for themselves.
If you require any help with this challenge please do not hesitate to come and chat to the development focus group. We have a channel on irc.freenode.net #ubuntu-beginners-dev
Or you can pm me