Skip to content

Небольшие исправления и улучшения текста в теме Многострочный режим якорей. #1945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 9-regular-expressions/05-regexp-multiline-mode/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ console.log( str.match(/^\d/g) ); // 1

## Поиск в конце строки $

Символ доллара `pattern:$` ведёт себя аналогично.
Якорь `pattern:$` ведёт себя аналогично.

Регулярное выражение `pattern:\d$` ищет последнюю цифру в каждой строке
Регулярное выражение `pattern:/\d$/gm` ищет последнюю цифру в каждой строке:

```js run
let str = `Винни: 1
Пятачок: 2
Слонопотам: 3`;

console.log( str.match(/\d$/gm) ); // 1,2,3
console.log( str.match(/\d$/gm) ); // 1, 2, 3
```

Без флага `pattern:m` якорь `pattern:$` обозначал бы конец всей строки, и была бы найдена только последняя цифра.
Expand Down