Mastering Regular Expression 代码介绍 2 - HTML 格式转换
来源:互联网 发布:淘宝助理属性不一致 编辑:程序博客网 时间:2024/05/16 15:17
#HTML 格式转换,使用regular library 简化程序
#Building a regex library
$HostnameRegex = qr/[-a-z0-9]+(\.[-a-z0-9]+)*\.(com|edu|info)/i;
# Turn email addresses into links . . .
$text =~ s{
\b
# Capture the address to $1 . . .
(
\w[-.\w]* # username
\@
$HostnameRegex # hostname
)
\b
}{<ahref="mailto:$1">$1</a>}gix;
# Turn HTTP URLs into links . . .
$text =~ s{
\b
# Capture the URL to $1 . . .
(
http:// $HostnameRegex \b # hostname
(
/ [-a-z0-9_:\@&?=+,.!/~*'%\$]* # Optional path
(?<![.,?!]) # not allowed to end with [.,?!]
)?
)
}{<a href="$1">$1</a>}gix;- Mastering Regular Expression 代码介绍 2 - HTML 格式转换
- Mastering Regular Expression 代码介绍 1 - HTML 格式转换
- Mastering Regular Expression 代码介绍 3 - HTML 格式转换
- Mastering Regular Expression 代码介绍 - 摄氏度 华氏度 转换
- Mastering Regular Expression 代码介绍 1 - 重复单词处理
- O'Reilly: mastering regular expression读中感2
- Mastering Regular Expression - 介绍 1 ( lookahead 光看不吃 )
- O'Reilly: mastering regular expression读中感
- regular expression(2)
- LeetCode Regular Expression Matching 极品代码赏析
- Mastering Regular Expressions [ILLUSTRATED]
- regular expression
- Regular Expression
- regular expression
- Regular Expression
- Regular Expression
- regular expression
- Regular Expression
- flash学习资料整理
- VIM参考手册
- java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
- solr分布式配置之索引复制(原创)
- scrollview 内容重用小demo(懒人专用哈)
- Mastering Regular Expression 代码介绍 2 - HTML 格式转换
- Quartz Core 图层编程
- 我要开始写C#和JAVA自学日记了
- Javascript在页面加载时的执行顺序
- APEX 3.2上Interactive Report 的表头复制(1)(APEX4.1下运行通过)
- javaScript对象
- wse 2.0 错误代码1001 解决方法
- (转)C#中浮点数依IEEE-754标准转二进制串
- iphone编程dispatch的使用