gsub global operator

20 views
Skip to first unread message

fugee ohu

unread,
Feb 5, 2019, 3:34:03 AM2/5/19
to Ruby on Rails: Talk
Does gsub have a global operator? How do I gsub in cases where there are multiple  lines that need to be treated as a single string? 

Walter Lee Davis

unread,
Feb 5, 2019, 8:33:03 AM2/5/19
to rubyonra...@googlegroups.com

> On Feb 5, 2019, at 3:34 AM, fugee ohu <fuge...@gmail.com> wrote:
>
> Does gsub have a global operator? How do I gsub in cases where there are multiple lines that need to be treated as a single string?

What is the difference between sub() and gsub()?

https://docs.ruby-lang.org/en/2.3.0/String.html#method-i-sub
https://docs.ruby-lang.org/en/2.3.0/String.html#method-i-gsub

What makes you think that gsub needs any special hint to treat a multi-line string as a source of multiple matches? Show your work.

Walter

>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c9dcb4ae-c3fb-4932-868b-4a2390295327%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

fugee ohu

unread,
Feb 5, 2019, 5:06:18 PM2/5/19
to Ruby on Rails: Talk
I decided I don't want to gsub anything out but instead save a match to a variable That would be a different topic than gsub so should I start a new thread?
Reply all
Reply to author
Forward
0 new messages