Util.Match Method
Gets a value that indicates whether the test matches the specified pattern.
Namespace: Microsoft.Office.Interop.InfoPath
Assembly: Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)
Syntax
'Declaration
Function Match ( _
bstrValue As String, _
bstrPattern As String _
) As Boolean
'Usage
Dim instance As Util
Dim bstrValue As String
Dim bstrPattern As String
Dim returnValue As Boolean
returnValue = instance.Match(bstrValue, _
bstrPattern)
bool Match(
string bstrValue,
string bstrPattern
)
Parameters
bstrValue
Type: System.StringThe string to test against the pattern.
bstrPattern
Type: System.StringThe pattern to use.
Return Value
Type: System.Boolean
true if the specified value matches the specified pattern; otherwise false.
Remarks
The Match method can be used to test any string against a regular expression. The regular expression must conform to the W3C's XML Schema specification for regular expressions (http://www.w3.org/TR/xmlschema-2/\#regexs).
Note
The XML Schema specification for regular expressions is different from regular expressions in Perl.
Examples
In the following example, the variable isSsnValid is set to a value that indicates whether or not the value stored in the my:SSN node is a legal Social Security Number:
IXMLDOMNode ssnNode = thisXDocument.DOM.selectSingleNode(@"//my:SSN");
bool isSsnValid = thisXDocument.Util.Match(ssnNode.text, @"\d\d\d-\d\d-\d\d\d\d");