Ruby get a list of all matching strings between two words using regex -
i can't figure out how list of matching strings between 2 words using regex. here's example of mean:
string='some text "mediaurl":"link1" more text "mediaurl":"link2" more text "mediaurl":"link3" more text' i'd extract link1, link2, , link3 string above.
i've tried:
string[/mediaurl\":\"(.+?)\"/m][1] the problem there returns first result (link1) i'd return array of links found between matching regex. how that?
string.scan(/mediaurl":"(.+?)"/)
Comments
Post a Comment