Answer the question
In order to leave comments, you need to log in
How to compose a regular expression for selecting words from a dictionary according to a certain pattern?
It is necessary to select words from the dictionary, in which first there is one consonant from the set [bvgdzhzk], then one or more of any vowels, then again one consonant from the set [bvgdzhzk], and then an arbitrary number of any letters. She wrote this:
var str = 'человек время дело жизнь день рука раз работа слово место лицо друг';
str=str.match(/[бвгджзк]{1}[аяеэюуёоиы]{1}[бвгджзк]{1}[а-яА-ЯёЁ]{0,}/gi)
console.log(str)
Answer the question
In order to leave comments, you need to log in
Why is it giving out a word fragment?
\b
denoting word boundaries, but it is not applicable in this case, since you have Cyrillic characters here. You can think of a word boundary as the beginning of a line, or a whitespace character, or the end of a line. Like this:Why is it giving out a word fragment?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question