A
anonieko
Here is an example. For a time server which returns a time field
string, you can extract the time by the following code:
'VB.NET
Imports System.Text.RegularExpressions
'..
Dim s As String
Dim r As Regex
s = "Grennwich time 12:15pm September 1, 2001"
r = New Regex(".*(\d{2}:\d{2}[ap]m)", RegexOptions.IgnoreCase)
If r.Match(s).Success Then
Console.Write(r.Match(s).Result("$1"))
// C#
using System.Text.RegularExpressions;
//...
String s = "Grennwich time 12:15pm September 1, 2001";
Regex r = new Regex(".*(\d{2}:\d{2}[ap]m)", RegexOptions.IgnoreCase);
if ( r.Match(s).Success)
{
Console.Write(r.Match(s).Result("$1"));
}
string, you can extract the time by the following code:
'VB.NET
Imports System.Text.RegularExpressions
'..
Dim s As String
Dim r As Regex
s = "Grennwich time 12:15pm September 1, 2001"
r = New Regex(".*(\d{2}:\d{2}[ap]m)", RegexOptions.IgnoreCase)
If r.Match(s).Success Then
Console.Write(r.Match(s).Result("$1"))
// C#
using System.Text.RegularExpressions;
//...
String s = "Grennwich time 12:15pm September 1, 2001";
Regex r = new Regex(".*(\d{2}:\d{2}[ap]m)", RegexOptions.IgnoreCase);
if ( r.Match(s).Success)
{
Console.Write(r.Match(s).Result("$1"));
}