# RedNails Released

**URL:** <https://www.ruby-forum.com/t/rednails-released/79228>\
**Category:** Ruby\
**Created:** [December 13, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/rednails-released/79228 "2006-12-13T14:02:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zev\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/eb8c5e/32.png) [@Zev\_B](https://www.ruby-forum.com/u/Zev_B)\
**Post date:** [December 13, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/rednails-released/79228/1 "2006-12-13T14:02:17Z")

</div>

RedNails is template driven data scraping API.

[http://rednails.rubyforge.org](http://rednails.rubyforge.org)

RedNails uses a template to create a regular expression that catches  
user marked variables. When a string of data is passed to RedNails it  
will use the regular expression to extract the matches and return them  
to the user.

If the scraped data is regular enough then RedNails is a simple way to  
extract  
data as all one needs to do is copy a live data feed and mark the points  
to  
extract and make this the template.

Usage:

1. Create a template.
2. Load and initialize an instance of a RedNails object with the  
template.
3. Pass this instance your data feed from which you wish to extract  
information.
4. Use the results.

Template Format:  
A RedNails template is simply a text file that has the points to scrape  
marked  
with what looks like a ruby string substitution. You give each  
substitution a  
unique variable name which can then be referenced when using the  
parse\_hash method.

An example template is:

“Hello my name is #{name}. How are you?”

If the data string to scrape is:

“Hello my name is Mr.Bill. How are you?”

Then the following code fragement will produce “Mr.Bill”:

require ‘rednails’  
rednails = RedNails.new(“template.txt”)  
results = rednails.parse\_hash(“livedata.txt”)  
puts results[“name”] # =\> Mr.Bill

For more details see the RedNails URL listed at the top.

RedNails has been in production use for a number of years, although  
this is the first public release of the API. If you have any  
problems, comments, or recommendations please feel free to mail me.

Thanks,  
Zev
