RESULTS:
Execution Time(sec.):
0.000006
Raw Match Pattern:
(\b(8|08|10):\d{2}-[a-zA-Z]{2}-\d{3,5}\b)
Match Pattern Explanation:
The regular expression:
(?i-msx:(\b(8|08|10):\d{2}-[a-zA-Z]{2}-\d{3,5}\b))
matches as follows:
NODE EXPLANATION
----------------------------------------------------------------------
(?i-msx: group, but do not capture (case-insensitive)
(with ^ and $ matching normally) (with . not
matching \n) (matching whitespace and #
normally):
----------------------------------------------------------------------
( group and capture to \1:
----------------------------------------------------------------------
\b the boundary between a word char (\w)
and something that is not a word char
----------------------------------------------------------------------
( group and capture to \2:
----------------------------------------------------------------------
8 '8'
----------------------------------------------------------------------
| OR
----------------------------------------------------------------------
08 '08'
----------------------------------------------------------------------
| OR
----------------------------------------------------------------------
10 '10'
----------------------------------------------------------------------
) end of \2
----------------------------------------------------------------------
: ':'
----------------------------------------------------------------------
\d{2} digits (0-9) (2 times)
----------------------------------------------------------------------
- '-'
----------------------------------------------------------------------
[a-zA-Z]{2} any character of: 'a' to 'z', 'A' to 'Z'
(2 times)
----------------------------------------------------------------------
- '-'
----------------------------------------------------------------------
\d{3,5} digits (0-9) (between 3 and 5 times
(matching the most amount possible))
----------------------------------------------------------------------
\b the boundary between a word char (\w)
and something that is not a word char
----------------------------------------------------------------------
) end of \1
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------
C#.NET Code Example:
using System;
using System.Text.RegularExpressions;
namespace myapp
{
class Class1
{
static void Main(string[] args)
{
String sourcestring = "source string to match with pattern";
Regex re = new Regex(@"(\b(8|08|10):\d{2}-[a-zA-Z]{2}-\d{3,5}\b)",RegexOptions.IgnoreCase);
Match m = re.Match(sourcestring);
for (int gIdx = 0; gIdx < m.Groups.Count; gIdx++)
{
Console.WriteLine("[{0}] = {1}", re.GetGroupNames()[gIdx], m.Groups[gIdx].Value);
}
}
}
}
$matches Array:
(
[0] => 10:11-se-223
[1] => 10:11-se-223
[2] => 10
)