using System;
using System.Text.RegularExpressions;
string s="this is some thing about england abc,but it isn't about usa abc.";
Regex re= new Regex(@".{4}abc");
MatchCollection mc = re.Matches(s);
foreach (Match m in mc)
Console.WriteLine(m.Value);
using System.Text.RegularExpressions;
string s="this is some thing about england abc,but it isn't about usa abc.";
Regex re= new Regex(@".{4}abc");
MatchCollection mc = re.Matches(s);
foreach (Match m in mc)
Console.WriteLine(m.Value);
解决方案 »
- 急求一个源码的在线考试系统!
- Discuz!NT 合并问题 请各位大侠帮忙....
- ASP.NET MVC2.0 根据用户的不同来显示不同的内容,怎么来做?
- 请教,怎么在DataSet里取这样的数据?
- 请大家帮我解决一个小问题!谢谢!急,再线结帐!
- DataTable 绑定 100%结贴
- 如何设置一个DATAGRID的每条记录行的高度?属性生成器里只有列的设置(包括列的字体大小)?
- ASP.NET中能否像PB的DataWindow一样冻结部分列;以及固定标题列
- INSERT INTO 语句的语法错误?
- 是不是用户对象必须继承System.Web.UI.UserControl
- 一个关于更新数据库表中数据的问题?!
- 如何在客户端JAVASCRIP读取viewstate中的内容
<HEAD>
<title>WebForm3</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 78px; POSITION: absolute; TOP: 67px" runat="server"></asp:TextBox>
<asp:Button id="Button1" OnClick="button1_Click" style="Z-INDEX: 102; LEFT: 329px; POSITION: absolute; TOP: 151px" runat="server" Text="Button"></asp:Button>
</form>
<Script runat="server" language="vb">
Dim pStr As String
Sub Button1_Click(Sender As Object ,e As EventArgs)
Dim str,tempStr As String
Str ="this is some thing about england abc,but it isn't about usa abc."
Call GetStr(Str,tempStr)
Response.Write(pStr)
End Sub
Function GetStr(Str As string,tempStr As String) As String
Dim IntPos As integer
IntPos=InStr(Str,"abc") -4
If IntPos >0 Then
tempStr =tempStr &" "& Mid(Str,IntPos,4+3)
Str = Mid(Str,IntPos + 4 +3)
GetStr(Str,tempStr)
Else
pStr =tempStr
Exit Function
End If
End Function
</Script>
</body>
</HTML>以上是经过测试的,没有一点问题,运用了递归函数.其它的变量可自行根据需要设定.