KM
Size: a a a
KM
АГ
X
A
VL
KM
KM
A
KM
X
T
PS
AM
DD
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' <-- только это слово должно остаться
]
*/
К
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' <-- только это слово должно остаться
]
*/
R
OJ
К
\s([a-zA-Z]+)($|\s)
К