I want to remove a part of a string following what matches my regex.
I am trying to make a TV show organization program and I want to cut off anything in the name f
matches() tries to match the whole string again the pattern. If you want to find your pattern within a string, use find(), find() will search for the next match in the string.
matches()
find()
Your code could be quite the same:
if(m.find()) return name.substring(0, m.end());