I'm trying to filter an array that contains a bunch of urls. I need to return the urls that only contain the word contact.
For example there is a link https://www.example.com/v1/contact-us/ca
This should be returned from the filter.
I tried this:
const regex = new RegExp(/bcontactb, 'g' )
sites.links.filter((val) => {
console.log(regex.test(val.href))
})
It currently just sends back false through all the domains, when I know there is one domain that contains the word contact.