Tuesday, November 16, 2010

Ruby and Regular Expressions

I have decided for the nth time to learn Ruby, mainly because I've been playing with ruby on rails apps for years now, but I do not have the language essentials to go beyond the typical functionality covered in tutorials or project documentation.

So for starters, I am reading the pragmatic book on ruby 1.9 which by the way, is on offer for only $10 this week (don't know for how long, so hurry up!). The book is very readable and to the point, as most of the titles in the pragmatic bookshelf.

And although the language is definitely different for me, coming from a Java background, I got immediately hooked by one aspect of it which till now had been, to say the least, a bit scary to me; the use of regular expressions.

As a Java developer I had used regexp before, but in a very limited and focused way, which happened to be the creation of validation expressions for fields in GUIs. I am not implying that this is the only use case for regexps in Java, no no no, but personally, I had only used them in that context before.

It is nice to see how in Ruby they are such a used technique, and the book encourages you to use them from very early. As I said, I had been scared of regexp in the past. I had even bought a couple of books about them that I never got to read.

So today I went looking for some easy resources in the shape or short videos that I can watch during lunch, ant I came across this one, which happens to explain the subject quite well, and it's accompanied by a long-ish post and even a few more videos. All very interesting if you are into this kind of thing!

No comments:

Post a Comment