14.01.2013 Views

Mastering Regular Expressions - Table of Contents

Mastering Regular Expressions - Table of Contents

Mastering Regular Expressions - Table of Contents

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

• After a successful match, the variables $1, $2, $3, etc., are available and hold the text<br />

matched by their respective parenthesized subexpressions in the regex. Subexpressions are<br />

numbered by counting open parentheses from the left, starting with one. The subexpressions<br />

can be nested, such as with (United States( <strong>of</strong> America)?) .<br />

Parentheses can be intended for grouping only, but as a byproduct they still match<br />

into one <strong>of</strong> the special variables. On the other hand, they are <strong>of</strong>ten inserted<br />

specifically to fill a numbered variable. This technique allows you to use a regex to<br />

pluck information from a string.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!