en.javascript.info/9-regular-expressions/14-regexp-lookahead-lookbehind/2-insert-after-head/task.md
2019-09-06 16:50:41 +03:00

30 lines
585 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Вставьте после фрагмента
Есть строка с HTML-документом.
Вставьте после тега `<body>` (у него могут быть атрибуты) строку `<h1>Hello</h1>`.
Например:
```js
let regexp = /ваше регулярное выражение/;
let str = `
<html>
<body style="height: 200px">
...
</body>
</html>
`;
str = str.replace(regexp, `<h1>Hello</h1>`);
```
После этого значение `str`:
```html
<html>
<body style="height: 200px"><h1>Hello</h1>
...
</body>
</html>
```