Regular Expressions to the Rescue

Working my way through the Launch School curriculum and I had nearly forgotten how much I love regular expressions! Look at how beautiful this is:

def valid_number?(num)
  num =~ /\-?\d+\.?\d*f?/

It’s just lovely. The most wonderful site, Rubular was a huge help in working out the details. It’s a terrific little sandbox that allows you to test out our regular expressions in Ruby. You can see exactly what you’re picking up and exactly what you’re leaving behind and it’s wonderful. I could easily spend all day there.

Ok, back to work now.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s