import "./pattern" for Pattern
var doc = """
-
Invisibility Cream
14.50
Makes you invisible
-
Levitation Salve
23.99
Levitate yourself for up to 3 hours per application
-
Blork and Freen Instameal
4.95
A tasty meal in a tablet; just add water
-
Grob winglets
3.56
Tender winglets of Grob. Just add water
"""
var p1 = Pattern.new("- ")
var match2 = p2.find(doc)
System.print("The first 'item' element is:")
System.print(" " + doc[match1.index..match2.index + 6])
var p3 = Pattern.new("[+1^<]/price>")
var matches = p3.findAll(doc)
System.print("\nThe 'prices' are:")
for (m in matches) System.print(m.captures[0].text)
var p4 = Pattern.new("[+1^<]/name>")
var matches2 = p4.findAll(doc)
var names = matches2.map { |m| m.captures[0].text }.toList
System.print("\nThe 'names' are:")
System.print(names.join("\n"))