POSIX 字符组
来源:互联网 发布:王者世界韩服数据转移 编辑:程序博客网 时间:2024/06/18 09:27
-- Start
什么是 POSIX 呢? POSIX 是 Portable Operating System Interface (可移植操作系统接口) 的缩写,它是一系列标准,确保操作系统之间的移植性。通常支持正则表达式的工具都支持下列 POSIX 字符组。
元字符(Metacharacter)匹配(Matches)[[:alnum:]]字母和数字[[:alpha:]]字母[[:blank:]]空格和制表符[[:cntrl:]]控制字符[[:digit:]]数字[[:graph:]]非空白字符[[:lower:]]小写字母[[:print:]]类似[[:graph:]],但是包含空白字符[[:punct:]]标点符号[[:space:]]空白字符[[:upper:]]大写字母[[:xdigit:]]十六进制中容许出现的数字(例如 0-9a-fA-f)
下面是一个简单的例子。
#!/usr/bin/perl my $testText = "I love regular expressions.";if($testText =~ m/reg[[:alpha:]]lar/) { print "finds the word.";} else { print "cannot find the word.";}public static void main(String[] args) { String testText = "I love regular expressions."; String regExp = "reg\\p{Alpha}lar"; Pattern p = Pattern.compile(regExp); Matcher m = p.matcher(testText); if (m.find()) { System.out.println("finds the word."); } else { System.out.println("cannot find the word."); }}
--更多参见:正则表达式精萃
-- 声 明:转载请注明出处
-- Last Updated on 2012-05-10
-- Written by ShangBo on 2012-05-10
-- End
- POSIX 字符组
- POSIX字符类总结
- POSIX字符类
- POSIX常用字符集合
- Linux中的POSIX字符类
- Linux正则表达式-POSIX字符类
- 正则表达式——POSIX字符类
- POSIX
- POSIX
- posix
- POSIX
- POSIX
- POSIX
- POSIX
- Posix
- POSIX
- POSIX
- POSIX
- 多重背包
- RC复位电路
- 2012.5.10. ONE仿真之修改源代码
- java hashMap
- java垃圾回收机制
- POSIX 字符组
- gdb调试
- ubuntu12.04 32bit 安装 JDK6
- Linux下查看文件和文件夹大小
- DirectShow SDK编译中易出现的问题
- jquery插件的开发
- css 属性 background:transparent;
- java解析xml技术
- 杭电2022 海选女主角