Last active
November 13, 2018 01:17
-
-
Save ReganRyanNZ/e8c8d9b5751b700a4970f3483196e0ef to your computer and use it in GitHub Desktop.
Grep href and title out of XML
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
# Get links and title for handy html building from xml | |
xml = "Paste your xml here" | |
links = xml.split("</cell>").map do |cell| | |
url_regex = /[^><]*<\/url>/m | |
next unless cell[url_regex] | |
href = cell[url_regex][/[^><]*/m] | |
title = cell[/[^><]*<\/text>/m][/[^><]*/m] | |
[title, href] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment