随笔分类 - 正则表达式
摘要:有价值的参考资料: http://net.pku.edu.cn/~yhf/tao_regexps_zh.html http://www.unibetter.com/deerchao/zhengzhe-biaodashi-jiaocheng-se.htm 正则表达式30分钟入门教程 应用: 在js的RegExp()对象和C#中使用正则表达式有注意转意符号 eg: 1、(匹配数字)var reg...
阅读全文
摘要:reg=/^\s+$/g reg.test(str) 匹配数字字母下划线: /^\w+$/g 例子: text = Regex.Replace(text, "[\\s]{2,}", " ");//two or more spaces text = Regex.Replace(text, "()+|()", "\n");//回车 text = Regex.Replace(text,...
阅读全文