Wednesday, 27 June 2012

Lync Normalisation Rules - Pattern Matching

The table below outlines some of the available regular expressions for Lync number normalisation.  


Element
Meaning
Example
Explanation of example
^
Match at beginning of string
^123
Match the digits 123 at the beginning of the string
()
Captures the matched sub expression
(456)
Capture what is between the parentheses into a numbered variable, starting at 1 which can be accessed as $n, eg $1
*
Specifies zero or more matches
\d(*)
+
Specifies one or more matches
\d(+)
?
Specifies zero or one matches
\d(?)
{n}
Specifies exactly n matches
\d{4}
Match 4 digits
{n,}
Specifies at least n matches
\d{3,}
Match at least 3 digits (with no limit to number of digits matched
{n,m}
Specifies at least n, but no more than m, matches.
\d{3,6}
Match at least 3 digits but no more than 6 digits
\d
Matches any decimal digit
^\d
Match any decimal digit (at the beginning of a string)
|
Matches any one of the terms separated by the | (vertical bar) character
134 | 135
Match either the string 134 or the string 135
$
The match must occur at the end of the string
^(123)$
Match exactly digits 123 (and not 1234)

The Lync number normalisation is based on .NET regular expression, more details can be found on the MSDN site: http://msdn.microsoft.com/en-us/library/hs600312

No comments:

Post a Comment