You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's because by default a caret `pattern:^`only matches at the beginning of the text, and in the multiline mode -- at the start of any line.
35
+
কেননা ক্যারেট চিহ্ন `pattern:^`ডিফল্টভাবে কেবলমাত্র টেক্সটের শুরুতে মিল খুঁজে, এবং মাল্টিলাইন মোডে -- এটি যেকোন লাইনের শুরুতে মিল খুঁজে।
36
36
37
37
```smart
38
-
"Start of a line" formally means "immediately after a line break": the test `pattern:^` in multiline mode matches at all positions preceeded by a newline character `\n`.
38
+
"লাইনের শুরু" দিয়ে বুঝায় "লাইন ব্রেকের পরপর": মাল্টিলাইন মোডে `pattern:^` লাইনের শুরু হতে নিউলাইন ক্যারাক্টারের `\n` আগ পর্যন্ত মিলে।
39
39
40
-
And at the text start.
40
+
এবং টেক্সটের শুরু হতে।
41
41
```
42
42
43
-
## Searching at line end $
43
+
## ডলার চিহ্ন $ লাইনের শেষে সার্চ করে
44
44
45
-
The dollar sign `pattern:$`behaves similarly.
45
+
ডলার চিহ্নও `pattern:$`একই ধরণের আচরণ করে।
46
46
47
-
The regular expression `pattern:\d$`finds the last digit in every line
47
+
`pattern:\d$`রেগুলার এক্সপ্রেশনটি প্রতি লাইনের শেষ অংশটি খুঁজবে।
48
48
49
49
```js run
50
50
let str =`Winnie: 1
@@ -54,21 +54,21 @@ Eeyore: 3`;
54
54
alert( str.match(/\d$/gm) ); // 1,2,3
55
55
```
56
56
57
-
Without the flag `pattern:m`, the dollar`pattern:$`would only match the end of the whole text, so only the very last digit would be found.
57
+
`m` ফ্ল্যাগ ছাড়া, ডলার চিহ্ন`pattern:$`কেবলমাত্র টেক্সটের শেষে মিল খুঁজে, সুতরাং আমরা শুধু শেষের অংশটি পাবো।
58
58
59
59
```smart
60
-
"End of a line" formally means "immediately before a line break": the test `pattern:$` in multiline mode matches at all positions succeeded by a newline character `\n`.
60
+
"লাইনের শেষ" দিয়ে বুঝায় "লাইন ব্রেকের পূর্বপর্যন্ত": মাল্টিলাইন মোডে `pattern:$` নিউলাইন ক্যারাক্টারের `\n` আগ হতে শুরু করে নতুন নিউলাইন অথবা টেক্সটের শুরু পর্যন্ত মিল খুঁজে।
61
61
62
-
And at the text end.
62
+
এবং টেক্সটের শেষ হতে।
63
63
```
64
64
65
-
## Searching for \n instead of ^ $
65
+
## ^ $ এর পরিবর্তে \n দিয়ে সার্চিং
66
66
67
-
To find a newline, we can use not only anchors `pattern:^`and`pattern:$`, but also the newline character `\n`.
67
+
নতুন লাইন শুরু হয়েছে কিনা তা কেবল `pattern:^`এবং`pattern:$` দিয়ে জানা ছাড়াও আমরা `\n` ক্যারাক্টারও ব্যবহার করে জানতে পারি।
68
68
69
-
What's the difference? Let's see an example.
69
+
চলুন একটা উদাহরণের মাধ্যমে পার্থক্য বুঝার চেষ্টা করি।
70
70
71
-
Here we search for `pattern:\d\n` instead of`pattern:\d$`:
71
+
এখানে আমরা `pattern:\d$` এর পরিবর্তে`pattern:\d\n` খুঁজি:
72
72
73
73
```js run
74
74
let str =`Winnie: 1
@@ -78,10 +78,10 @@ Eeyore: 3`;
78
78
alert( str.match(/\d\n/gm) ); // 1\n,2\n
79
79
```
80
80
81
-
As we can see, there are 2 matches instead of 3.
81
+
এখানে আমরা দেখতে পাচ্ছি। ৩ টা ফলাফলের বদলে ২ টি ফলাফল পাওয়া গেছে।
82
82
83
-
That's because there's no newline after `subject:3`(there's text end though, so it matches `pattern:$`).
83
+
কেননা `subject:3`এর পর কোন নিউলাইন নেই (যদি টেক্সট শেষও হয়ে যায়, `pattern:$` ব্যবহার করলে আমরা `subject:3`-ও পেতাম)।
84
84
85
-
Another difference: now every match includes a newline character `match:\n`. Unlike the anchors `pattern:^``pattern:$`, that only test the condition (start/end of a line), `\n`is a character, so it becomes a part of the result.
85
+
আরেকটি পার্থক্য: এখন পাওয়া প্রতিটি মিলে একটি নিউলাইন `match:\n` ক্যারাক্টারও অন্তর্ভুক্ত। অ্যাঙ্কর প্যাটার্নগুলো `pattern:^``pattern:$` কেবল লাইনের শুরু আর শেষের কন্ডিশন চেক করে, যেহেতু `\n`ও একটি ক্যারাক্টার, এটিও ফলাফলের একটি অংশ হয়ে যায়।
86
86
87
-
So, a `\n` in the pattern is used when we need newline characters in the result, while anchors are used to find something at the beginning/end of a line.
87
+
সুতরাং, আমাদের ফলাফলে যদি নিউলাইন ক্যারাক্টার প্রয়োজন হয় আমরা প্যাটার্নে `\n` ব্যবহার করি, অন্যথায় লাইনের শুরুতে বা শেষে কিছু খুঁজতে অ্যাঙ্কর ব্যবহার করি।
0 commit comments