ruby - How to gsub with wild characters (for spaces) -


i need replace combo of 2 words combo disregarding number of spaces between them, possible kind of wildcards in single line ?

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") 

the \s escape code match on whitespace (spaces , tabs)

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


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -