Character groups within sets in JavaScript regex

Character groups \d, \D, \w, \W, \s⁅/c ⁆, \S inside [] will denote groups, that is, they will still remain commands.

Example

In this example, the search pattern looks like this: any digit or letter from 'a' to 'f' is between x's:

javascriptlet str = 'xax xbx x1x x2x xhx x@x';
let res = str.replace(/x[\da-f]x/g, '!');

As a result, the following will be written to the variable:

javascript'! ! ! ! xhx x@x'

Example

In this example, the search pattern looks like this: letter 'x', then a non-digit, a non-dot, and not a small Latin letter, then letter 'z':

javascriptlet str = 'xaz x1z xAz x.z x@z';
let res = str.replace(/x[^\d.a-z]z/g, '!');

As a result, the following will be written to the variable:

javascript'xaz x1z ! x.z !'

Practical tasks

Задание 1

Write a regex that will find strings according to the pattern: digit or dot 1 or more times.

Задание 2

Write a regex that finds strings according to the pattern: a non-digit and non-letter from 'a' to 'g' from 3 to 7 times.