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)
Comments
Post a Comment