Category Archives: RegEx

Regular expressions make my head hurt

A site to dull the pain Rubular. Via Ruby Inside.

Also posted in Ruby, Ruby on Rails | Leave a comment

Mask Credit Card Numbers with Regular Expressions in Rails

Sometimes you need to display sensitive information in a browser, such as the credit card a customer has on file. Obviously you don’t want to show the entire card number in case the customer leaves there browser open on a public computer, or even worse someone hacks into their account. However, you do need to [...]

Also posted in Ruby on Rails | 1 Comment

Rails validation make sure your user passwords are strong

Most user created passwords are astoundingly weak (’12345′, ‘mypass’). How do you make them stronger? Don’t give them a choice!
Here’s how to validate a password in RoR to make sure it’s strong using a regular expression (regex).
In your model add a custom validate method (after the regular validation) that adds an error unless the password [...]

Also posted in Ruby on Rails | 4 Comments