Skip to content

Commit dbab176

Browse files
translate until line-22
1 parent dd99936 commit dbab176

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

9-regular-expressions/04-regexp-anchors/article.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# Anchors: string start ^ and end $
1+
# لنگرها: رشته شروع ^ و پایان $
22

3-
The caret `pattern:^` and dollar `pattern:$` characters have special meaning in a regexp. They are called "anchors".
3+
کاراکترهای `pattern:^` و دلار `pattern:$` معنای خاصی در یک regexp دارند. به آنها "لنگر" می گویند.
44

55
The caret `pattern:^` matches at the beginning of the text, and the dollar `pattern:$` -- at the end.
6+
`pattern:^` در ابتدای متن و `pattern:$` دلاری -- در پایان متن مطابقت دارد.
67

7-
For instance, let's test if the text starts with `Mary`:
8-
8+
به عنوان مثال، بیایید آزمایش کنیم که آیا متن با `Mary` شروع می شود یا خیر:
99
```js run
1010
let str1 = "Mary had a little lamb";
11-
alert( /^Mary/.test(str1) ); // true
11+
alert( /^Mary/.test(str1) ); // درست
1212
```
1313

14-
The pattern `pattern:^Mary` means: "string start and then Mary".
14+
الگوی `pattern:^Mary` به معنای "شروع رشته و سپس Mary" است.
1515

16-
Similar to this, we can test if the string ends with `snow` using `pattern:snow$`:
16+
مشابه این، می‌توانیم با استفاده از `pattern:snow$` آزمایش کنیم که آیا رشته به `snow` ختم می‌شود:
1717

1818
```js run
1919
let str1 = "its fleece was white as snow";
20-
alert( /snow$/.test(str1) ); // true
20+
alert( /snow$/.test(str1) ); // درست
2121
```
2222

2323
In these particular cases we could use string methods `startsWith/endsWith` instead. Regular expressions should be used for more complex tests.

0 commit comments

Comments
 (0)