C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Symbol.match PropertyThe JavaScript Symbol.match is used to identify the matching of a regular expression against a string. Syntax
Symbol.match Parameters
String Return valueReturn true if a string matches otherwise false. Browser Support
Example 1
<script>
//JavaScript to illustrate Symbol.match
var reg = /JavaTpoint/;
reg[Symbol.match] = false;
// check string start with hello
document.write('/JavaTpoint/'.startsWith(reg));
// check string ends with hi
document.write("<br>");
document.write('/we/'.endsWith(reg));
//expected output: true
// false
</script>
Output: True False Example 2
<script>
//JavaScript to illustrate Symbol.match
var reg = /Java123/;
reg[Symbol.match] = false;
// check string start with qw
document.write('/qw/'.startsWith(reg));
// check string ends with 34
document.write("<br>");
document.write('/34/'.endsWith(reg));
//expected output: false
// false
</script>
Output: false false
Next TopicJavaScript Symbol
|