When trying to implement case-insensitivity using regex, it seems to work well for plain strings. However, if special characters like parenthesis are involved in the search query for the name, the database returns no results.
For example, a search for "Push It" will yield songs successfully. But searching for "Escape (The Pina Colada Song)" does not return any results. How can I modify the Regex pattern to account for these special characters?
Any tips or suggestions would be greatly appreciated.
const lowercaseName = new RegExp(`^${name}`, 'i')
const songs: any = await Song.find({ name: lowercaseName, artist_id })