preg_match_all—执行一个全局正则表达式匹配int preg_match_all ( string pattern, string subject, array matches [, int flags] )在 subject 中搜索所有与 pattern 给出的正则表达式匹配的内容并将...
分类:
Web程序 时间:
2014-07-31 20:01:12
阅读次数:
207
import java.util.regex.Pattern;/*** 过滤标签字符串,返回纯文本**/public class ChangePlainText {public static void main(String[] args) {String test="hihello~";Strin...
分类:
编程语言 时间:
2014-07-31 19:48:37
阅读次数:
303
前言:有很多时候,在一个生命周期中我们只要一个对象就可以了,比如:线程池,缓存,对话框,日志,显卡驱动等等。如果造出多个实例,就会导致许多问题产生,例如:程序的行为异常、资源使用过量,或者说不一致的结果。public class Singleton { private stati...
分类:
其他好文 时间:
2014-07-31 15:58:36
阅读次数:
287
KMP算法:/** KMP算法中获取模式中每位的next值。next[i]=j表示pattern[0..i]中最长前后缀后面的那个元素的位置为j在进行匹配的过程中,匹配失败则取得上一个 next 函数的值*/void get_next(char *pattern, int *next){int le...
分类:
其他好文 时间:
2014-07-31 13:03:16
阅读次数:
167
Pattern是要符合的模式
Matcher是用模...
分类:
其他好文 时间:
2014-07-30 20:48:04
阅读次数:
175
直接量语法:/pattern[/attributes]创建RegExp对象:var reg = new RegExp(pattern[,attributes]);pattern是一个字符串,指定正则表达式;attributes是一个可选的字符串,包含g,i,m,分别表示全局匹配、忽略大小写匹配和多行...
分类:
编程语言 时间:
2014-07-30 14:40:43
阅读次数:
216
?匹配任意一个字符,*匹配任务多个字符(包括0)#include #include int match(const char *src, const char *pattern){ if (src == NULL || pattern == NULL) { return 0...
分类:
其他好文 时间:
2014-07-30 11:34:53
阅读次数:
193
最近在学习saltstack的reactor模块,由于在业务上没有有关reactor的需求。这里只是举个例子,方便将来参考使用。原理:reactor分为两部分:tag和sls。reactor去匹配这个tag(event的tag),匹配到则执行对应的sls文件。这个需要结合event。其实这个类似于zabbix的triggers。在配..
分类:
其他好文 时间:
2014-07-29 18:18:33
阅读次数:
352
建立虚拟的源点和汇点,因为忽略掉了容量下界之后会导致流量不平衡,所以对于每个u,v,u多出来的流量流到汇点,v不够的流量从源点补流#include #include #include #include #include #include #include #include #include #inc...
分类:
其他好文 时间:
2014-07-29 17:07:12
阅读次数:
215
关键词:factory pattern , Dependency Injection(DI), Guice(pronounced “juice” )
参考:
【1】维基DI :http://en.wikipedia.org/wiki/Dependency_injection
【2】一篇博文:http://www.blogjava.net/xylz/archive/2009/xylz/arch...
分类:
其他好文 时间:
2014-07-29 15:10:38
阅读次数:
266