Right, the challenge.
In the fewest characters possible, implement grep. This version of grep is called as follows:
grep.rb regexp [File(s)]
If no files are present, the script should read from stdin. No requirements to support the various switches/flags, just that the script outputs lines matching the regexp.
Support Ruby regular expressions, rather than grep.
Restrictions:
1) No system calls of any kind
2) You shouldn't have to "require" or "load" anything
3) The results should be printed to STDOUT, one line of output per matching string.
This post has been edited by xclite: 03 October 2012 - 07:12 AM

New Topic/Question
Reply





MultiQuote






|