С
Size: a a a
С
С
РБ
ЧК
РБ
n
Д
OJ
const inputValue = "[javascript] created:2016..2019 answers:1 -React -[angular] -[jquery] thisWordOnly"
function getSearchWords(inputValue) {
const words = inputValue.split(' ')
const skipRegex = /^-?\[.*\]$/gi // <-- не умею в регулярки
const necessaryWords = words.filter(word => {
const skip = !skipRegex.test(word)
return skip
})
return necessaryWords
}
console.log(getSearchWords(inputValue))
/*
[
'created:2016..2019',
'answers:1',
'-React',
'-[jquery]',
'thisWordOnly' <-- только это слово должно остаться
]
*/
j
j
j
j
К
j
ЛВ
j
P
const inputValue = "[javascript] created:2016..2019 answers:1 -React -[angular] -[jquery] thisWordOnly"
function getSearchWords(inputValue) {
const words = inputValue.split(' ')
const skipRegex = /^-?\[.*\]$/gi // <-- не умею в регулярки
const necessaryWords = words.filter(word => {
const skip = !skipRegex.test(word)
return skip
})
return necessaryWords
}
console.log(getSearchWords(inputValue))
/*
[
'created:2016..2019',
'answers:1',
'-React',
'-[jquery]',
'thisWordOnly' <-- только это слово должно остаться
]
*/
P
OJ