Skip to content

Instantly share code, notes, and snippets.

@BanzaiMan
Created July 16, 2019 19:48
Show Gist options
  • Select an option

  • Save BanzaiMan/a4df24e27e210a0e0db0738c29ac7b25 to your computer and use it in GitHub Desktop.

Select an option

Save BanzaiMan/a4df24e27e210a0e0db0738c29ac7b25 to your computer and use it in GitHub Desktop.

Revisions

  1. BanzaiMan created this gist Jul 16, 2019.
    29 changes: 29 additions & 0 deletions named_captures.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    HHVM_VERSION_REGEXP = /
    (?:hhvm$)
    |(
    hhvm-(
    (?<numeric>\d+(\.\d+)*)(?<lts>-lts)?$
    |
    (?<version>
    dbg$|
    dev$|
    nightly$|
    nightly-dbg$|
    dev-nightly$
    )
    )
    /x

    vers = %w(
    hhvm
    hhvm-nightly
    hhvm-
    hhvm-3.25
    hhvm-3.25-lts
    )

    vers.each do |v|
    if md = HHVM_VERSION_REGEXP.match(v)
    puts md.inspect
    end
    end