在表示重复的字符后面加问号,比如+?,*?,{2,3}?可以停止匹配的贪婪模式。 1 var pattern=/\w{2,3}/; 2 console.log("aaaa".match(pattern)[0]); 3 /*结果"aaa";贪婪模式下会尽可能多的匹配, 4 所以会匹配3个重复的字符 5...
分类:
Web程序 时间:
2014-08-26 08:32:35
阅读次数:
204
这两个组件比较交单,大家看下会使用就行了
XML文件配置
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match...
分类:
移动开发 时间:
2014-08-25 22:54:15
阅读次数:
306
题目链接Tatyana is a big sports fan and she likes volleyball a lot! She writes down the final scores of the game after it has ended in her notebook.If you...
分类:
其他好文 时间:
2014-08-25 20:42:04
阅读次数:
248
test test 返回 Boolean,查找对应的字符串中是否存在模式。var str = "1a1b1c";var reg = new RegExp("1.", "");alert(reg.test(str)); // trueexec exec 查找并返回当前的匹配结果,并以数组的形式返回。v...
分类:
Web程序 时间:
2014-08-25 19:12:14
阅读次数:
204
今天内容
1.正则表达式
2.数学函数
3.日期函数
4.错误处理
正则表达式:
1.模式修正符
2.五个常用函数
另外一个正则表达式的网站:http://www.jb51.net/tools/zhengze.html
正则表达式
1.原子
2.元子符
3.模式修正符
正则表达式函数
1.preg_match();
2.pr...
分类:
Web程序 时间:
2014-08-25 02:19:23
阅读次数:
257
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1029这题就是一个大水题但应注意读懂题目意思这里不解释了我的AC代码#include#includeint hash[1000000];int main(void){ int n,i,a; wh...
分类:
其他好文 时间:
2014-08-24 20:41:02
阅读次数:
172
题目:uva10201 - Adventures in Moving - Part IV(01背包)
题目大意:一辆车要走D距离,然后它有个200L油箱,并且一开始有100L,现在给你一路上你会遇到的加油站,和这个加油站每升油的价钱,要求你最后到终点的时候油需要大于等于100L,问你加油最少的费用。如果到达不了目标地点就输出Impossible。
解题思路:首先要先到达这个加油...
分类:
其他好文 时间:
2014-08-23 23:04:01
阅读次数:
437
通常情况下,我们判断一个字符串中是否存在某值常常会用string.contains,其实判断一个字符串中存在某值的方法有很多种,最常用的就是前述所说的string.contains,相对来说比较常用的还有string.IndexOf和Regex.Match。直接上代码,后面在说些什么吧,通常情况.....
分类:
其他好文 时间:
2014-08-23 15:20:10
阅读次数:
189
//获取地址栏参数function getQueryStringByName(name) { var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i")); if (result == null ...
分类:
其他好文 时间:
2014-08-23 01:04:49
阅读次数:
210
AbsListView.LayoutParams lp=new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,64);这句话的意思是 创建一个布局(LayoutParams)的实例 lp。AbsListView.Layout...
分类:
移动开发 时间:
2014-08-23 00:59:29
阅读次数:
290