RUBY

Ruby provides a subset of Perl-style regular expressions built into the Regexp and String classes. Ruby uses a Traditional NFA match engine. For an explanation of the rules behind a Traditional NFA engine, see "Introduction to Regexes and Pattern Matching.”

Ruby 1.9 introduces a new regular expression engine that includes several new features. These features are available in earlier releases as part of the Oniguruma library. The following reference primarily covers Ruby 1.8.6, but the most prominent Ruby 1.9 features are also included and marked.

Get Regular Expression Pocket Reference, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.