Regex构造函数
Regex(string pattern)
Regex(string pattern,RegexOptions options)
参数说明
pattern:要匹配的正则表达式模式
options:指定是否要编译,忽略大小写等等
Regex.Replace方法
-C#
Regex.Replace(string input,string replacement)
Regex.Replace(string input,string replacement,int count)
Regex.Replace(string input,string replacement,int count,int startat)
Regex.Replace(string input,MatchEvaluator evaluator)
Regex.Replace(string input,MatchEvaluator evaluator,int count)
Regex.Replace(string input,MatchEvaluator evaluator,int count,int startat)
参数说明
input:要修改的字符串
replacement:替换字符串
count:进行替换的最大次数
startat:输入字符串开始搜索的位置
evaluator:在每一步计算替换的MatchEvaluator。就是一个函数代理,参数为Match类型,匹配的数据。
-C#
asp.net--C#字符串只执行一次替换的示例代码
string s = "aaa";
Regex r = new Regex("a");
s=r.Replace(s,"b",1);
Response.Write(s);//输出baa

最新文章

  1. embedding mono实战笔录(一)
  2. myeclipse+tomcat 工程名改名的问题 ——————完美解决方案
  3. GO语言练习:网络编程 ICMP 示例
  4. 网页二维码推广App的实现
  5. JAVA基础知识之练习题——集合
  6. c++builder6.0 mdi窗体+自定义子窗体
  7. delphi 自动滚动到最底端scroll
  8. 进程,线程(thread)
  9. eclipse安装Hadoop1.1.2版本开发插件
  10. TFboy养成记 CNN
  11. CTF---Web入门第三题 这个看起来有点简单!
  12. Curl是什么,原文地址:http://www.phpchina.com/portal.php?mod=view&aid=40161
  13. 关于前端本地压缩图片,兼容IOS/Android/PC且自动按需加载文件之lrz.bundle.js
  14. CSS3 移动端 1PX 线变成0.5PX
  15. Android网页打开指定App
  16. 背水一战 Windows 10 (112) - 通知(Badge): application 的 badge 通知, secondary 的 badge 通知, 轮询服务端以更新 badge 通知
  17. HashMap代码解析
  18. windows服务安装 System.IO.FileLoadException
  19. python学习笔记(五)- 文件操作
  20. 第34 memcached缓存

热门文章

  1. JZOJ 5462. 【NOIP2017提高A组冲刺11.8】好文章
  2. Bubblesort冒泡算法
  3. 从0到n-1中随机等概率输出m个不同的数
  4. DFS:Tempter of the Bone (规定时间达到规定地点)
  5. sql中比较大小
  6. SpringCloud 微服务一:spring boot 基础项目搭建
  7. loj2052 「HNOI2016」矿区
  8. leetcode 【 Pascal's Triangle II 】python 实现
  9. 使用 Item,ItemManager 在 XNA 中创建物品和道具(十六)
  10. 04 JVM是如何执行方法调用的(下)