|
|
@ -1006,8 +1006,8 @@ let txt = 'In 2019, I run 30 Days of Pyhton. Now, in 2020 I super exited to star
|
|
|
|
let regEx = /\d+/ // d with escape character means d not a normal d instead acts a digit
|
|
|
|
let regEx = /\d+/ // d with escape character means d not a normal d instead acts a digit
|
|
|
|
// + means one or more digit numbers,
|
|
|
|
// + means one or more digit numbers,
|
|
|
|
// if there is g after that it means global, search everywhere.
|
|
|
|
// if there is g after that it means global, search everywhere.
|
|
|
|
console.log(text.match(regEx)) // ["2", "0", "1", "9", "3", "0", "2", "0", "2", "0"]
|
|
|
|
console.log(txt.match(regEx)) // ["2", "0", "1", "9", "3", "0", "2", "0", "2", "0"]
|
|
|
|
console.log(text.match(/\d+/g)) // ["2019", "30", "2020"]
|
|
|
|
console.log(txt.match(/\d+/g)) // ["2019", "30", "2020"]
|
|
|
|
```
|
|
|
|
```
|
|
|
|
20. *repeat()*: it takes a number argument and it returned the repeated version of the string.
|
|
|
|
20. *repeat()*: it takes a number argument and it returned the repeated version of the string.
|
|
|
|
```js
|
|
|
|
```js
|
|
|
|