In Ruby, what regex will strip out all but a desired string if present in the containing string? I know about
/[^abc]/ for characters, but what about strings?
Say I have the string
"group=4&type_ids=2&type_ids=7&saved=1" and want to retain the pattern
group=\d, if it is present in the string using only a regex?
Currently, I am splitting on
& and then doing a select with matching condition
=~ /group=\d/ on the resulting enumerable collection. It works fine, but I'd like to know the regex to do this more directly.
© Stack Overflow or respective owner