Use parentheses within patterns,just as you can in arithmetic expressions : Regexps Repetition « Development « Ruby
Use parentheses within patterns,just as you can in arithmetic expressions
# A pattern that matches a string containing the text Perl or the text Python
Related examples in the same category
have Repetition match the minimum by adding a question mark suffix.
use part of the current match later in that match allows you to look for various forms of repetition.
use back references to match delimiters.
A pattern that matches a string containing the text Perl or the text Python
You can also specify repetition within patterns.
match one of a group of characters within apattern
Match a time such as 12:34:56
Match Perl, zero or more other chars, then Python
Match Perl, a space, and Python
Match Perl, zero or more spaces, and Python
Match Perl, one or more spaces, and Python
Match Perl, whitespace characters, then Python
Match Ruby, a space, and either Perl or Python
The match operator =~ can be used to match a string against a regular expression.
The part of a string matched by a regular expression can be replaced
Replace every occurrence of Perl and Python with Ruby
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.