 |
Regular Expressions
First page Back Continue Last page Overview Graphics
Regular Expressions
Perl regular expression features borrowed by Java, C#, and other languages
Sample regular expression to match an IP address:
\d{1,3} ( \. \d{1,3} ){3}
1-3 digits followed by 3 more groups of 1-3 digits each preceded by a period
Sample usage:
if ( ! $input =~ /^\d{1,3}(\.\d{1,3}){3}$/ ) {
die "Sorry, $input is not an IP address\n";
}
|
 |
 |