Skip to content

Commit b811623

Browse files
authored
Merge pull request Asabeneh#77 from MiddleOutManager/patch-1
Update match.js
2 parents 1ef3e93 + a136d11 commit b811623

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

02_Day/string_methods/match.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ console.log(string.match(pattern)) // ["love", "love", "love"]
1515
// Let us extract numbers from text using regular expression. This is not regular expression section, no panic.
1616

1717
let txt = 'In 2019, I run 30 Days of Pyhton. Now, in 2020 I super exited to start this challenge'
18-
let regEx = /\d+/ // d with escape character means d not a normal d instead acts a digit
18+
let regEx = /\d/g // d with escape character means d not a normal d instead acts a digit
1919
// + means one or more digit numbers,
2020
// if there is g after that it means global, search everywhere.
21-
console.log(text.match(regEx)) // ["2", "0", "1", "9", "3", "0", "2", "0", "2", "0"]
22-
console.log(text.match(/\d+/g)) // ["2019", "30", "2020"]
21+
console.log(txt.match(regEx)) // ["2", "0", "1", "9", "3", "0", "2", "0", "2", "0"]
22+
console.log(txt.match(/\d+/g)) // ["2019", "30", "2020"]

0 commit comments

Comments
 (0)