如何使用通配符(用于空格)进行 gsub

How to gsub with wild characters (for spaces)

我需要用另一个组合替换 2 个单词的组合,忽略它们之间的任意数量的空格,是否可以在单行中使用任何类型的通配符?

text.gsub(/Create Proc/i,"Delete Proc")      ## single space
text.gsub(/Create  Proc/i,"Delete Proc")     ## 2 spaces
text.gsub(/Create   Proc/i,"Delete Proc")    ## 3 spaces
text.gsub(/Create\s+Proc/i,"Delete Proc")

\s 转义码将匹配空格(空格和制表符)

http://rubular.com/r/0bqvUBnojC