ASP.NET正则表达式查找字符串中重复的字符
来源:互联网 发布:剑三冷艳御姐捏脸数据 编辑:程序博客网 时间:2024/05/07 02:14
using System;
using System.Text.RegularExpressions;
public class Test
...{
public static void Main ()
...{
// Define a regular expression for repeated words.
Regex rx = new Regex(@"(?<word>w+)s+(k<word>)",
RegexOptions.Compiled | RegexOptions.IgnoreCase);
// Define a test string.
string text = "The the quick brown fox fox jumped over the lazy dog dog.";
// Find matches.
MatchCollection matches = rx.Matches(text);
// Report the number of matches found.
Console.WriteLine("{0} matches found.", matches.Count);
// Report on each match.
foreach (Match match in matches)
...{
string word = match.Groups["word"].Value;
int index = match.Index;
Console.WriteLine("{0} repeated at position {1}", word, index);
}
}
}
using System.Text.RegularExpressions;
public class Test
...{
public static void Main ()
...{
// Define a regular expression for repeated words.
Regex rx = new Regex(@"(?<word>w+)s+(k<word>)",
RegexOptions.Compiled | RegexOptions.IgnoreCase);
// Define a test string.
string text = "The the quick brown fox fox jumped over the lazy dog dog.";
// Find matches.
MatchCollection matches = rx.Matches(text);
// Report the number of matches found.
Console.WriteLine("{0} matches found.", matches.Count);
// Report on each match.
foreach (Match match in matches)
...{
string word = match.Groups["word"].Value;
int index = match.Index;
Console.WriteLine("{0} repeated at position {1}", word, index);
}
}
}
- ASP.NET正则表达式查找字符串中重复的字符
- ASP.NET正则表达式查找字符串中重复的字符
- Python 正则表达式查找字符串中特定字符
- 用正则表达式(零宽断言)去除字符串中重复的字符
- Asp.net的正则表达式,匹配指定的字符和字符串。
- Python 正则表达式查找不是某个字符的字符串
- ASP.NET中常用的正则表达式
- ASP.Net中常用的正则表达式
- 关于正则表达式中去掉重复字符的问题
- 查找字符串中第一次重复的字符 java
- 查找字符串中第一次不重复的字符 java
- 查找字符串中第一个不重复的字符
- 查找字符串中最长无重复字符的子串
- 查找字符串中最长重复字符的子串
- 查找字符串中第一个不重复的字符
- 查找字符串中出现最多的字符和个数(两种方法一个普通方法 一个是正则表达式方式)
- 去掉重复字符的正则表达式
- Linux正则表达式-重复出现的字符
- 推荐的一些IT网站论坛
- 活动桌面处理和一个例子
- 线程池的设计与实现
- 2、一个简单的AVR中断程序
- 发布两个ASP.NET控件ComboBox 和DateControl
- ASP.NET正则表达式查找字符串中重复的字符
- 浮动DIV代码
- 呵呵,只是开通而已
- 创建ASP.NET数据存储层
- Eclipse自动生成注释
- 中国各省份的由来
- RSS 简介
- JAVA学习者的好去处,几个经典的JAVA学习网站
- 龙芯软件开发(14)--串口输出