RegexOptions.IgnoreCase正则表达式替换,忽略大小写
时间:2022-05-03 17:25:45
////////////////////////////
string inputstr = "@{AbcD},@{bbbb},@{ABcd}";
string pmType = "@";
string regTxt = (pmType + "\\s*\\{\\s*" + "abcd" + "\\s*\\}").Replace("(", "\\(").Replace(")", "\\)");
//string regTxt = (pmType + "\\s*\\{\\s*" + "aaaa" + "\\s*\\}").Replace("(", "\\(").Replace(")", "\\)");
// string regTxt = @"@\s*\{\s*aaaa\s*\}";
// string regTxt = @"@\s*\{\s*aaaa\s*\}/gi";
inputstr = Regex.Replace(inputstr, regTxt, "CCC", RegexOptions.IgnoreCase | RegexOptions.Compiled);
///////////////
对于小文本不使用 RegexOptions.Compiled;
标签:正则表达式,大小写
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
JAVA中 redisTemplate 和 jedis的配合使用操作
2022-05-01 23:38:46
![](https://img.aspxhome.com/file/2023/2/78912_0s.jpg)
springboot+vue制作后台管理系统项目
2022-02-26 06:08:37
![](https://img.aspxhome.com/file/2023/4/69654_0s.png)
学生信息管理系统java版
2023-06-16 15:48:10
springboot如何读取配置文件到静态工具类
2023-11-28 04:44:54
![](https://img.aspxhome.com/file/2023/6/60036_0s.png)
浅谈C#中的for循环与foreach循环
2021-08-23 03:27:38
Java输入/输出流体系详解
2023-03-01 06:37:00
![](https://img.aspxhome.com/file/2023/9/65739_0s.png)
Maven setting.xml配置文件详解
2023-06-28 00:33:41
spring security动态配置url权限的2种实现方法
2021-06-25 15:31:12
java 多线程的几种实现方法总结
2023-10-14 17:43:18
ReadWriteLock接口及其实现ReentrantReadWriteLock方法
2023-11-24 01:46:52
![](https://img.aspxhome.com/file/2023/3/59873_0s.png)
Spring MVC URL地址映射的示例代码
2022-12-09 19:53:33
![](https://img.aspxhome.com/file/2023/3/72903_0s.jpg)
MyBatis-Plus 查询返回实体对象还是map
2023-11-28 03:20:19
Java高性能序列化工具Kryo详情
2021-11-02 16:42:00
![](https://img.aspxhome.com/file/2023/9/68499_0s.png)
MyBatis-Plus找不到Mapper.xml文件的几种解决方法
2023-11-24 03:37:52
Java 按行读取文件按行写入文件并以空格分割字符串的方法
2023-08-31 12:32:21
Java制作智能拼图游戏原理及代码
2022-08-02 21:46:57
深入探究Java中的类加载机制
2022-01-14 22:11:00
![](https://img.aspxhome.com/file/2023/7/75677_0s.png)
如何将写好的.py/.java程序变成.exe文件详解
2022-04-06 09:22:14
![](https://img.aspxhome.com/file/2023/1/70161_0s.png)
Mybatis-Plus进阶分页与乐观锁插件及通用枚举和多数据源详解
2023-11-23 11:00:58
![](https://img.aspxhome.com/file/2023/2/59382_0s.png)
如何使用SpringSecurity保护程序安全
2022-09-08 19:57:50