mirror of
https://github.com/alrayyes/wiki.git
synced 2025-06-22 21:06:34 +00:00
Quartz sync: May 6, 2024, 10:40 PM
This commit is contained in:
parent
aee9145691
commit
4ef8371441
635 changed files with 22281 additions and 6 deletions
20
content/20201104101723-javascript_regexp_test_method.md
Normal file
20
content/20201104101723-javascript_regexp_test_method.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
id: eff92c39-8459-4f55-a34b-d924eb603056
|
||||
title: JavaScript RegExp Test Method
|
||||
---
|
||||
|
||||
test[^1] returns true/false:
|
||||
|
||||
``` javascript
|
||||
let re1 = new RegExp("abc");
|
||||
let re2 = /abc/;
|
||||
|
||||
console.log(re1.test("abc")) // true
|
||||
console.log(re1.test("acd")) // false
|
||||
console.log(/abc/.test("abcde")) // true
|
||||
console.log(/abc/.test("abxde")) // false
|
||||
```
|
||||
|
||||
# Footnotes
|
||||
|
||||
[^1]: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test>
|
Loading…
Add table
Add a link
Reference in a new issue