Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

jagne kvrj, ngochan1126@hotmail.­com, a asdfghjhhjjkl', cvezrtg, chink chinese frankies, lambhead@rocketmail.com, priwalfdept77@yahoo.de, from scipy.optimize import minpack2 ImportError: DLL load failed: 找不到指定的模块。, yamlå, adfghjshjklç

Links

XODOX
Impressum

#1: 一个正则问题

Posted on 2012-08-22 03:22:59 by 快乐周末

《精通正则表达式》第三版 p74
#将HTTP URL转换为链接形式 ...
$text =~ s{
\b
(
http:// [-a-z0-9]+(\.[-a-z0-9]+)+\.(com;edu;info) \b
(
/ [-a-z0-9R:\@&?=+,.!/ ̃+’%\$]+
)?
)
}{<a href="$1">$1</a>}gix;

匹配hostname部分为何有个“\b” ?为什么不把\b放到path后面,像这样
$text =~ s{
\b
(
http:// [-a-z0-9]+(\.[-a-z0-9]+)+\.(com;edu;info)
(
/ [-a-z0-9R:\@&?=+,.!/ &#771;+’%\$]+
)?
)
\b
}{<a href="$1">$1</a>}gix;

--

※ 来源:・水木社区 http://newsmth.net・

Report this message