# Re: Beginning Ruby

**URL:** <https://www.ruby-forum.com/t/re-beginning-ruby/73769>\
**Category:** Ruby\
**Created:** [October 26, 2006, 10:46pm UTC](https://www.ruby-forum.com/t/re-beginning-ruby/73769 "2006-10-26T22:46:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [October 26, 2006, 10:46pm UTC](https://www.ruby-forum.com/t/re-beginning-ruby/73769/1 "2006-10-26T22:46:50Z")

</div>

From: phalcos [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

> Im quite new to Ruby (unexpected heh?) but is currently planning on  
> building a website community with it just in order to see how powerful  
> it accually can be.

Welcome!  
Are you planning on using any existing Ruby web framework (Rails, IOWA,  
RubyWeb, to name just a few) to build your website, or creating your own  
from scratch?

> 1. How can I make sure the userinput only contains certain characters?  
> Like if I only want my users to be able to give me [A-Za-z0-9], is  
> regex the only alternative?

Regex is not your only alternative, but certainly one of the more  
flexible/powerful. input.gsub!( /\W/, ‘’ ) # so easy! 🙂  
A lot of the frameworks have their own ways to describe and  
auto-validate input for you.

> 1. Is there any builtin method for converting html-characters  
> into safe input, like what htmlspecialchars in PHP does?

See [Network and Web Libraries](http://phrogz.net/ProgrammingRuby/lib_network.html#CGI.escapeHTML)  
And again, Rails and others have their own helpers on this front.

> 1. Methods for SQL database storage?

Again, more helpers for the frameworks, like ActiveRecord for Rails.  
If you’re rolling your own, it depends on the database.  
Ruby’s DBI is a RDBMS-independent wrapper:  
[http://ruby-dbi.rubyforge.org/](http://ruby-dbi.rubyforge.org/)

> 1. Anything else I should think about?

Think about learning one of the popular frameworks. It may be a  
significant change from being used to handle every aspect of the  
development yourself, but you may find that you like the power and  
development speed that they give you.
