Home > perl-HostRange

perl-HostRange

Perl-HostRange is a project mainly written in ..., it's free.

Perl module port of ruby gem host_range.

Name HostRange.pm

Usage use HostRange; my @hosts = HostRange::parse 'foo-[ab][05,09-12].bar.com'

Patterns Simple atoms of one character:

  HostRange::parse 'foo-[a-c]'          # ["foo-a", "foo-b", "foo-c"]

Ranges are parsed using the perl ‘..’ operator:

  HostRange::parse 'foo-[a-c]'          # ["foo-a", "foo-b", "foo-c"]

Multiple atoms and ranges separated by commas:

  HostRange::parse 'foo-[1,3-5,9]'      # ["foo-1", "foo-3", "foo-4", "foo-5", "foo-9"]

Combined:

  HostRange::parse 'foo-[ab][01-02]'    # ["foo-a01", "foo-a02", "foo-b01", "foo-b02"]