- 论坛徽章:
- 0
|
LZ不妨看看这个:
?: 表示非捕获符号。就是什么也不匹配。
(?!pattern) 如果正则表达式在后面不匹配 pattern ,才会开始匹配。如/foo(?!bar)/,只有当出现 foo,并且后面不出现 bar 时才开始匹配.
Type Regex Successful if the enclosed subexpression ...
Positive Lookbehind (?<=......) successful if can match to the left #例子:"abcdefg" =~ m/(?<=c)/;
print $`,$&,$';
Negative Lookbehind (?<!......) successful if can not match to the left
Positive Lookahead (?=......) successful if can match to the right #例子: "abcdefg" =~ m/(?=c)/;
print $`,$&,$';
Negative Lookahead (?!......) successful if can not match to the right
函数substr 也能达到目的 |
|