本文整理汇总了VB.NET中System.Text.RegularExpressions.RegexCompilationInfo.MatchTimeout属性的典型用法代码示例。如果您正苦于以下问题:VB.NET RegexCompilationInfo.MatchTimeout属性的具体用法?VB.NET RegexCompilationInfo.MatchTimeout怎么用?VB.NET RegexCompilationInfo.MatchTimeout使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。
在下文中一共展示了RegexCompilationInfo.MatchTimeout属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: Main
' 导入命名空间
Imports System.Reflection
Imports System.Text.RegularExpressions
Module Example
Public Sub Main()
' Match two or more occurrences of the same character.
Dim pattern As String = "(\w)\1+"
' Use case-insensitive matching.
Dim rci As New RegexCompilationInfo(pattern, RegexOptions.IgnoreCase,
"DuplicateChars", "CustomRegexes",
True, TimeSpan.FromSeconds(2))
' Define an assembly to contain the compiled regular expression.
Dim an As New AssemblyName()
an.Name = "RegexLib"
Dim rciList As RegexCompilationInfo() = New RegexCompilationInfo() { rci }
' Compile the regular expression and create the assembly.
Regex.CompileToAssembly(rciList, an)
End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System.Text.RegularExpressions,代码行数:23,代码来源:RegexCompilationInfo.MatchTimeout
示例2: Example
' 导入命名空间
Imports CustomRegexes
Imports System.Text.RegularExpressions
Module Example
Public Sub Main()
Dim rgx As New DuplicateChars(TimeSpan.FromSeconds(.5))
Dim values() As String = { "Greeeeeat", "seed", "deed", "beam",
"loop", "Aardvark" }
' Display regex information.
Console.WriteLine("Regular Expression Pattern: {0}", rgx)
Console.WriteLine("Regex timeout value: {0} seconds",
rgx.MatchTimeout.TotalSeconds)
Console.WriteLine()
' Display matching information.
For Each value In values
Dim m As Match = rgx.Match(value)
If m.Success Then
Console.WriteLine("'{0}' found in '{1}' at positions {2}-{3}",
m.Value, value, m.Index, m.Index + m.Length - 1)
Else
Console.WriteLine("No match found in '{0}'", value)
End If
Next
End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System.Text.RegularExpressions,代码行数:28,代码来源:RegexCompilationInfo.MatchTimeout 输出:
Regular Expression Pattern: (\w)\1+
Regex timeout value: 0.5 seconds
eeeee' found in 'Greeeeeat' at positions 2-6
ee' found in 'seed' at positions 1-2
ee' found in 'deed' at positions 1-2
No match found in 'beam'
oo' found in 'loop' at positions 1-2
Aa' found in 'Aardvark' at positions 0-1
注:本文中的System.Text.RegularExpressions.RegexCompilationInfo.MatchTimeout属性示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论