Skip to content

Commit ddebc7b

Browse files
committed
Add match example
1 parent d3d3562 commit ddebc7b

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

JavaScript/3-match.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
'use strict';
22

3-
let s = 'My email is ';
3+
const s = 'Hello user1@domain.com and user2@domain.com';
44

5-
let rx = /\W@\W/g;
5+
const rx = /\S+@[\S.]+/g;
66

7-
let = (s
8-
.toLowerCase()
9-
.replace(/\W+/g, ' ')
10-
.trim()
11-
.split(/\s/)
12-
);
7+
const m = s.match(rx);
138

14-
console.dir(words);
9+
console.dir(m);

0 commit comments

Comments
 (0)