lib/phony/dsl.rb
def match regex, options = {}
      # Check if regexp has a group in it.
      #
      raise "Regexp /#{regex.source}/ needs a group in it that defines which digits belong to the NDC." unless regex.source =~ /\(/
      
      NationalSplitters::Regex.instance_for regex, options[:on_fail_take], options
    end
# If you have a number of (possibly) variable length NDCs
# that can be well expressed via regexp, use this.
#
# Parameters:
#   * regex A regexp describing the NDCs (First group must contain the NDC, eg. /^(0\d{2})\d+$/) contains all NDCs with 0xx...
#
# Example:
#   country '52',
#     match(/^(0\d{2})\d+$/)   >> split(2,2,2,2) |
#     match(/^(33|55|81)\d+$/) >> split(2,2,2,2) |
#     match(/^(\d{3})\d+$/)    >> split(3,2,2)
#
If you have a number of (possibly) variable length NDCs
that can be well expressed via regexp, use this.

regex A regexp describing the NDCs (First group must contain the NDC, eg.


If you have a number of ( possibly ) variable length NDCs that can be well expressed via regexp use this . regex A regexp describing the NDCs ( First group must contain the NDC eg .
def match regex, options = {}
      raise "Regexp /{regex.source}/ needs a group in it that defines which digits belong to the NDC." unless regex.source =~ /\(/
      NationalSplitters::Regex.instance_for regex, options[:on_fail_take], options
    end
def match regex , options = { } raise "Regexp /#{regex.source}/ needs a group in it that defines which digits belong to the NDC." unless regex . source =~ / \( / NationalSplitters :: Regex . instance_for regex , options [ :on_fail_take ] , options end
If you have a number of (possibly) variable length NDCs
that can be well expressed via regexp, use this.
If you have a number of ( possibly ) variable length NDCs that can be well expressed via regexp use this .
# Check if regexp has a group in it. #
regex
options