ruby - How can I extract part of a string that is in quotes -
say have string:
foo = "this string 'with string inside it!'"
how extract 'with string inside it!' foo
?
foo = "this string 'with string inside it!'" foo[foo.index("'")..foo.rindex("'")] #=> "'with string inside it!'"
Comments
Post a Comment