The best way is to test things out. I believe playing around with it is the best teacher. Try some of the online regex testers out there:
http://rubular.com is one of the best.
There's a bit of small documentation underneath. However, if you need more you could go to:
http://www.regular-expressions.info