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 170ad2a

Browse files
Chore: Activity-2 Completed for Day-19
1 parent 383cae9 commit 170ad2a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎Day19/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ console.log(matches);
2121
console.log("-------------------------------------------------");
2222
console.log("Activity 2: ");
2323

24+
// Task 3: Write a regular expression to match all words in a string that start with a capital letter. Log the matches.
25+
26+
pattern = /[A-Z][a-z]+/g;
27+
str = "The quick brown fox Jumps over the lazy dog.";
28+
matches = str.match(pattern);
29+
30+
console.log(matches);
31+
32+
// Task 4: Write a regular expression to match all sequences of one or more digits in a string. Log the matches.
33+
34+
pattern = /\d+/g;
35+
str = "There are 12 months in a year.";
36+
matches = str.match(pattern);
37+
38+
console.log(matches);
2439

2540

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

0 commit comments

Comments
(0)

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