From 4b200859052a5bfb5e45e305fd0cf6666630c93d Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 29 Aug 2025 18:21:18 +0900 Subject: [PATCH 1/2] fix(docs): resolve syntax errors and typos in regular-expression.md (#290) --- en/regular-expression.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/en/regular-expression.md b/en/regular-expression.md index dfffca36..07091742 100644 --- a/en/regular-expression.md +++ b/en/regular-expression.md @@ -15,7 +15,7 @@ A regular expression is an object that can either be constructed with the `RegEx new RegExp(pattern[, flags]); // using literals -/pattern/modifiers +/pattern/flags ``` The flags are optional while creating a regular expression using literals. Example of creating identical regular using above mentioned method is as follows. @@ -39,7 +39,7 @@ Example : ```javascript const str = "Hello world, hello again!"; -const regex = /hello/g; +const regex = /hello/gi; const matches = str.match(regex); // If you are thinking about .match() Read This 👇 // It is a built-in method in JavaScript that is used to search a string for a match against an expression. @@ -175,11 +175,11 @@ _Metacharacters_ are special character that has special meaning in the regular e | Metacharacter | Description | | ------------- | ---------------------------------------------------------------- | -| `.` | Match a single character excpet newline or a terminator | +| `.` | Match a single character except newline or a terminator | | `\w` | Match a word character (alphanumeric character `[a-zA-Z0–9_]`) | | `\W` | Match a non word character (same as `[^a-zA-Z0–9_]`) | | `\d` | Match any digit character( same as `[0-9]`) | -| `\D` | Match any non digiti character | +| `\D` | Match any non digit character | | `\s` | Match a whitespace character (spaces, tabs etc) | | `\S` | Match a non whitespace character | | `\b` | Match at the beginning / end of a word | @@ -219,7 +219,7 @@ let text = "The best things in life are free"; let result = /e/.exec(text); // looks for a match of e in a string // result: e - +console.log(result); // Result: ["e", 2, "The best things in life ar..."] let helloWorldText = "Hello world!"; // Look for "Hello" let pattern1 = /Hello/g; From 76b9c645069f299b6974bda93e08ab76edf888cf Mon Sep 17 00:00:00 2001 From: Suman Kunwar Date: Fri, 29 Aug 2025 09:32:39 -0400 Subject: [PATCH 2/2] Update en/regular-expression.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- en/regular-expression.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/regular-expression.md b/en/regular-expression.md index 07091742..b7f4e11b 100644 --- a/en/regular-expression.md +++ b/en/regular-expression.md @@ -179,7 +179,7 @@ _Metacharacters_ are special character that has special meaning in the regular e | `\w` | Match a word character (alphanumeric character `[a-zA-Z0–9_]`) | | `\W` | Match a non word character (same as `[^a-zA-Z0–9_]`) | | `\d` | Match any digit character( same as `[0-9]`) | -| `\D` | Match any non digit character | +| `\D` | Match any non-digit character | | `\s` | Match a whitespace character (spaces, tabs etc) | | `\S` | Match a non whitespace character | | `\b` | Match at the beginning / end of a word |