Returns a Boolean value that indicates whether the test matches the specified pattern.
expression.Match(ByVal bstrValue As String, ByVal bstrPattern As String) As Boolean
bstrValue Required String. The string to test against the pattern.
bstrPattern Required String. The pattern to use.
returns A Boolean value that indicates whether the string matches the pattern.
Security Level
0: Can be accessed without restrictions.
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 This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.
Note The XML Schema specification for regular expressions is different from regular expressions in Perl.
Example
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:
var SSN = XDocument.DOM.selectSingleNode(“//my:SSN”);
var isSSNValid = XDocument.Util.Match(SSN.text, "\\d\\d\\d-\\d\\d-\\d\\d\\d\\d");