VF
Size: a a a
VF
M
ИМ
РВ
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' <-- только это слово должно остаться
]
*/
PO
PO
ИМ
PO
inputValue.split(' ‘)
[6] разе не катит?PO
inputValue.split(' ‘)
[6] разе не катит?ИМ
OJ
D
D
M
D
M
D
D