1. Technology
Send to a Friend via Email

Regular Expressions

Discover how to use regular expressions in an effective manner. Each regular expression feature of Ruby will be explained and demonstrated with code samples.

5 Questions About Getting Started With Regular Expressions in Ruby
Regular Expressions provide a way to search for patterns, strings or specific characters in your code. Learn how to start creating regular expressions in Ruby.

Practical Regular Expressions: Email Addresses
Using regular expression to tell if an email address is valid or not.

Lookahead and Back-references
Using lookahead and back-references to refer to other parts of the regular expression text.

Regular Expression Options
Using options to change the behavior of regular expressions.

Endless Strings? The Beginning of the End
Without special syntax, there is no way to describe the beginning or end of a string in Ruby. The beginning and end are not characters, so they don't follow the normal rules for regular expression elements.

Special Characters & Escape Sequences
Aside from the basic regular expression operators such as groupings and quantifiers, there are some other special characters and escape sequences (backslash followed by a character) that can help you out when you're working with Ruby.

The Four Quantifiers
Quantifiers tell how many times an element should be matched. Below is a list of all quantifiers supported by the Ruby regular expression engine, how to use them and examples of their use. Though you can get by with the common quantifiers such as + or ?, there are a few more you should know about.

Regular Expressions 101
What are regular expressions and how to use them in Ruby?

Regular Expression Syntax
The basic syntactical elements of regular expressions in Ruby.

Regular Expressions: Grouping
The grouping operators, including the parentheses operator, are some of the most powerful and frequently used operators in the Ruby regex syntax.

Reference: Named Character Classes
A listing of the named character classes available to you in regular expressions in Ruby.

Regular Expression Guide
Regular Expressions on the Ruby User's Guide.

Regexp Class Documentation
Official documentation of the Regexp class.

General Information About Regular Expressions
General information about Regular Expressions, techniques to use and example expressions.

Regular Expressions Wikipedia Entry
Detailed information on regular expressions including theory of operation and history.

Regular Expression Library
A library of regular expression, forums about regular expressions and tools to help you compose and test regular expressions.

You can opt-out at any time. Please refer to our privacy policy for contact information.

©2014 About.com. All rights reserved.