Ruby 简单的拆分和解析?

Ruby simple split and parse?

我有以下公式:

Revenue - Costs * (1 + Profitpercentage)

我想解析它并只保留重要的字符串,这需要删除:空格、[-+*/=] 和括号。

我想出了以下代码:

p "Revenue - Costs * (1 + Profitpercentage)".split (/(\s|\.|\+|\-|\/|\*|\)/)

但这只给了:

["Revenue", " ", "", "-", "", " ", "Costs", " ", "", "*", "", " ", "(1", " ", "", "+", "", " ", "Profitpercentage)"]

如何清理我的代码?

str = "Revenue - Costs * (1 + Profitpercentage)"
p str.scan(/[A-Za-z]+/)
# => ["Revenue", "Costs", "Profitpercentage"]

String#scan