If the comment is just noise, why not use a regex like this:
"^(.*?)( \(.*)?$"
then _.group("name") will be what you want, regardless of the presence of a comment. (I don't know how greedy Scala's regex are by default; you might need to change the greediness to get this to work right.)
If you are using the comment for something, you can do the same regex as you are currently using, but change the end to: ... " ?(\((.*)\))?$"
no subject
"^(.*?)( \(.*)?$"
then _.group("name") will be what you want, regardless of the presence of a comment. (I don't know how greedy Scala's regex are by default; you might need to change the greediness to get this to work right.)
If you are using the comment for something, you can do the same regex as you are currently using, but change the end to:
... " ?(\((.*)\))?$"
(Again, possibly adjusting greediness.)