Util.Match(String, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value that indicates whether the test matches the specified pattern.
public:
bool Match(System::String ^ bstrValue, System::String ^ bstrPattern);
public bool Match (string bstrValue, string bstrPattern);
abstract member Match : string * string -> bool
Public Function Match (bstrValue As String, bstrPattern As String) As Boolean
Parameters
- bstrValue
- String
The string to test against the pattern.
- bstrPattern
- String
The pattern to use.
Returns
true if the specified value matches the specified pattern; otherwise false.
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.<span class="label">Match</span>(ssnNode.text, @"\d\d\d-\d\d-\d\d\d\d");
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.
Applies to
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기