Skip to content

Instantly share code, notes, and snippets.

@oleander
Last active August 29, 2015 14:07
Show Gist options
  • Save oleander/21b57c821f6706f512e5 to your computer and use it in GitHub Desktop.
Save oleander/21b57c821f6706f512e5 to your computer and use it in GitHub Desktop.

Revisions

  1. oleander revised this gist Sep 28, 2014. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,8 @@
    require "pp"

    e = "(E\s+[^\n]+)?"
    d = "[\n]+D\s+((?=E)[^E]+|[^\n]+)"
    e = "[(?=[\n]+E\s+)[\n]+E\s+(.+?)\n]?"

    a = "A\s+(.+?)"
    b = "[\n]+B\s+(.+?)"
    c = "[\n]+C\s+(.+?)"
    d = "[\n]+D\s+((?=E)[^E]+|[^\n]+)"
    e = "[(?=[\n]+E\s+)[\n]+E\s+(.+?)\n]?"
    pp File.read("ord.txt").scan(/(^\d{1,2})\.\s+(.+?(?=A\s+))#{a}#{b}#{c}#{d}#{e}/m).to_a
  2. oleander created this gist Sep 28, 2014.
    9 changes: 9 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    require "pp"

    e = "(E\s+[^\n]+)?"
    d = "[\n]+D\s+((?=E)[^E]+|[^\n]+)"
    e = "[(?=[\n]+E\s+)[\n]+E\s+(.+?)\n]?"
    a = "A\s+(.+?)"
    b = "[\n]+B\s+(.+?)"
    c = "[\n]+C\s+(.+?)"
    pp File.read("ord.txt").scan(/(^\d{1,2})\.\s+(.+?(?=A\s+))#{a}#{b}#{c}#{d}#{e}/m).to_a