I'm looping through an array of string-based song titles. My goal is to find if my base title is present within the array identical titles but with possible/additional characters. I'm running into a few problems with the few techniques I'm currently using. Using includes?
I must test both ways while downcasing:
"The Girl Is Mine (Paul McCartney)".downcase.include? "The Girl Is Mine" || "The Girl Is Mine".downcase.include? "The Girl Is Mine (Paul McCartney)"
I came across match?
but once additional the additional characters come in things don't work.
"The Girl Is Mine".match? /The Girl Is Mine (feat. Paul McCartney)/i
=> false
The goal is to find the beginning sequence of characters, case insensitive: "The Girl Is Mine"
. I don't really need anything to complex so if this can be done without an algorithm I'm all ears. If not I'm still all ears.