There are several questions on SO about parsing structured text in Ruby, but none of them apply to my case.
I'm the author of the Ruby Whois library. The library includes several parsers to parse a WHOIS response and extract the properties from the content.
So far, I used two approaches:
- Regular expressions for base parsers (e.g. whois.aero)
- StringScanner for advanced parsers (e.g. whois.nic.it)
Regular expressions are not efficient because if I need to extract 15 properties, I need to scan the same response at least 15 times.
StringScanner is a nice library, but creating an efficient scanner is not that simple.
I was wondering if is there some other Ruby tools you suggest to implement a WHOIS record parser. I was reading about Treetop but because WHOIS records lack of a specification, I believe Treetop is not the right solution.
Any suggestion?