S
Size: a a a
S
Е
Е
RM
АД
S
Е
Е
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' <-- только это слово должно остаться
]
*/
S
j
S
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' <-- только это слово должно остаться
]
*/
`[
'created:2016..2019',
'answers:1',
'-React',
'-[jquery]',
'thisWordOnly' <-- только это слово должно остаться
]`.match(/[a-z]+([A-Z][a-z]*)+/g)
es
RM
S
j
RM
S
j
j