前端之家收集整理的这篇文章主要介绍了
Perl 5 的正则表达式,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
use Regexp::Common;
# Dotted decimal IP address
/$RE{net}{IPv4}/;
# Dotted hexadecimal IP address
/$RE{net}{IPv4}{hex}/;
# Colon separated octal IP address
/$RE{net}{IPv4}{oct}{-sep => ':'}/;
# Dotted binary IP address
/$RE{net}{IPv4}{bin}/;
# MAC address
/$RE{net}{MAC}/;
# Space separated octal MAC address
/$RE{net}{MAC}{oct}{-sep => " "}/;
# a number
/$RE{num}{real}/;
# a ['"`] quoted string
/$RE{quoted}/;
# a /.../ sequence};
/$RE{delimited}{-delim=>'/'}/;
# balanced parentheses
/$RE{balanced}{-parens=>'()'}/;
# a #*@%-ing word
/$RE{profanity}/;
## Name Interface
use Regexp::Common 'RE_ALL';
# a number
RE_num_real();
# a ['"`] quoted string
RE_quoted();
# a /.../ sequence
RE_delimited(-delim=>'/');
# balanced parentheses
RE_balanced(-parens=>'()');
# a #*@%-ing word
RE_profanity();