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 1dbc803

Browse files
Chore: Activity-4 Completed for Day-19
1 parent 613ac8a commit 1dbc803

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
@@ -62,6 +62,21 @@ console.log(matches);
6262
console.log("-------------------------------------------------");
6363
console.log("Activity 4: ");
6464

65+
// Task 7: Write a regular expression to match a word only if it is at the beginning of a string. Log the matches.
66+
67+
pattern = /\b\w+/g;
68+
str = "Hello, World!";
69+
matches = str.match(pattern);
70+
71+
console.log(matches);
72+
73+
// Task 8: Write a regular expression to match a word only if it is at the end of a string. Log the matches.
74+
75+
pattern = /\w+\b/g;
76+
str = "The quick brown fox jumps over the lazy dog.";
77+
matches = str.match(pattern);
78+
79+
console.log(matches);
6580

6681

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

0 commit comments

Comments
(0)

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