Last active
January 4, 2017 13:38
-
-
Save thehashrocket/ef617f29458fc668da69e89629c89f38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string = "<token>important text</token> other stuff <token>more important text</token>" | |
matches = string.to_enum(:scan, /\<token\>(.*?)\<\token\>/).map { Regexp.last_match } | |
#=> [<#Match 1:>, <#Match 1:>] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment