Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 613ac8a

Browse files
Chore: Activity-3 Completed for Day-19
1 parent 170ad2a commit 613ac8a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎Day19/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ console.log(matches);
4141
console.log("-------------------------------------------------");
4242
console.log("Activity 3: ");
4343

44+
// Task 5: Write a regular expression to capture the area code, central office code, and line number from a US phone number format (e.g., (123) 456-7890). Log the captures.
45+
46+
pattern = /\((\d{3})\)\s(\d{3})-(\d{4})/;
47+
str = "(123) 456-7890";
48+
matches = str.match(pattern);
49+
50+
console.log(matches);
51+
52+
// Task 6: Write a regular expression to capture the username and domain from an email address. Log the captures.
53+
54+
pattern = /(\w+)@(\w+\.\w+)/;
55+
str = "yashsaini" + "@" + "gmail.com";
56+
let email = "yashkumarsaini0123456789@gmail.com";
57+
matches = email.match(pattern);
58+
59+
console.log(matches);
4460

4561

4662
console.log("-------------------------------------------------");

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /