Skip to content

Commit 18ad031

Browse files
edit reviews tasks
1 parent 6c771b4 commit 18ad031

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • 9-regular-expressions/01-regexp-introduction

9-regular-expressions/01-regexp-introduction/article.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,15 @@ let regexp = new RegExp(`<${tag}>`); // خواهد بود /<h2>/ جواب داد
8888
```js run
8989
let str = "We will, we will rock you";
9090
91-
let result = str.match(/we/i); // without flag g
91+
let result = str.match(/we/i); // بدون پرچم g
9292
93-
alert( result[0] ); // We (1st match)
93+
alert( result[0] ); // We (اولین تطابق)
9494
alert( result.length ); // 1
9595
9696
// Details:
9797
alert( result.index ); // 0 (موقعیت تطابق)
9898
alert( result.input ); // We will, we will rock you (رشته منبع)
9999
```
100-
101100
اگر بخشی از عبارت باقاعده در داخل پرانتز قرار بگیرد، ممکن است آرایه، ایندکس های دیگری در کنار ایندکس `0` نیز داشته باشد. ما آن را در فصل <info:regexp-groups> پوشش خواهیم داد.
102101
103102
3. و در نهایت، اگر هیچ تطابقی وجود نداشته باشد، `null` بر می گرداند. (فرقی نمی‌ کند که پرچم `pattern:g` وجود داشته باشد یا خیر).
@@ -108,7 +107,7 @@ let regexp = new RegExp(`<${tag}>`); // خواهد بود /<h2>/ جواب داد
108107
let matches = "JavaScript".match(/HTML/); // = null
109108
110109
if (!matches.length) { // Error: Cannot read property 'length' of null
111-
alert("Error in the line above");
110+
alert("خطا در خط بالایی");
112111
}
113112
```
114113
@@ -118,7 +117,7 @@ let regexp = new RegExp(`<${tag}>`); // خواهد بود /<h2>/ جواب داد
118117
let matches = "JavaScript".match(/HTML/)*!* || []*/!*;
119118
120119
if (!matches.length) {
121-
alert("No matches"); // now it works
120+
alert("No matches"); // الان درست کار میکند
122121
}
123122
```
124123

0 commit comments

Comments
 (0)