def assembly_regex(self, partition_lengths, delimiter, strict):
        mg = [r'(\d{%d})' % l for l in partition_lengths]
        rd = r'\%s?' % delimiter
        regex = rd.join(mg)

        # anchor the regex so that it wont take zip codes w/ longer
        # input than what is specified by the partition_lengths
        if strict:
            regex = "^" + regex + "$"

        return regex
dataset/ETHPy150Open formencode/formencode/formencode/national.py/DelimitedDigitsPostalCode.assembly_regex/original