my $htmlstr = "<html>teeest</htmlteeest>" ;
if($htmlstr =~ /\<(.*)\>(te.+?st)\<\/\1\2\>/){
print "regex match. \n";
}else{
print "regex not match. \n";
}
\1 表示第一个匹配到的值
[color=orange][b]定位字符串[/b][/color]
问号等号字符串,定位字符串前面; (“\b\w+(?=ing\b)”定位“ing”前面的字符串)
若要定位串后面,中间插个小于号; (“(?<=\bsub)\w+\b”定位“sub”后面的字符串)
原文:
[url]http://blog.csdn.net/thunder09/archive/2010/05/28/5630253.aspx[/url]
if($htmlstr =~ /\<(.*)\>(te.+?st)\<\/\1\2\>/){
print "regex match. \n";
}else{
print "regex not match. \n";
}
\1 表示第一个匹配到的值
[color=orange][b]定位字符串[/b][/color]
问号等号字符串,定位字符串前面; (“\b\w+(?=ing\b)”定位“ing”前面的字符串)
若要定位串后面,中间插个小于号; (“(?<=\bsub)\w+\b”定位“sub”后面的字符串)
原文:
[url]http://blog.csdn.net/thunder09/archive/2010/05/28/5630253.aspx[/url]