Share via


Util.Match method

Gets a value that indicates whether the test matches the specified pattern.

Namespace:  Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly:  Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.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.String

    The string to test against the pattern.

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.

Important

This member can be accessed without restrictions.

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");

See also

Reference

Util interface

Util members

Microsoft.Office.Interop.InfoPath.SemiTrust namespace