摘要: 如果在shell脚本中处理数据文件,那么我们就必须熟悉正则表达式。正则表达式是用来过滤数据流中文本的模式模板,模式由标准文本字符和特殊字符组成。正则表达式用特殊字符来匹配一系列一个或多个字符,要想掌握正则表达式,必须深刻认识每个特殊字符: .*^${}+?|()下面分别解释一下: 脱字符 ^ 定义从数据流中文本行的行首开始的字符; 美元符 $ 指明数据必须以该文本模式结尾; 点字符 . 用来匹配任意单字符,除了换行符; 字符组 [Yy] 用来匹配字符组中某个字符(比如y,但不清楚其大小写)出现在数据流中; 排除字符组 [^ch] 用来排除字符组中出现过字符(比如ch)的文本; 区间 [0-.. 阅读全文
posted @ 2013-12-19 20:08 七年之后 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to reach the last index in the minimum number of jumps.For example:Given array A =[2,3,1,1,4]The minimum n 阅读全文
posted @ 2013-12-19 14:50 七年之后 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you are able to reach the last index.For example:A =[2,3,1,1,4], returntrue.A =[3,2,1,0,4], returnfalse.cl 阅读全文
posted @ 2013-12-19 14:11 七年之后 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover the entire input string (not partial).The function prototype should be:bool i 阅读全文
posted @ 2013-12-19 11:47 七年之后 阅读(222) 评论(0) 推荐(0) 编辑