public function range($subPattern = null)
    {
        $arguments = func_get_args();

        // odd number of arguments, must assume last is subPattern
        if (count($arguments) % 2 === 1) {
            $subPattern = array_pop($arguments);
        } else {
            $subPattern = null;
        }

        $value     = '[';

        for ($fromIndex = 0; $fromIndex < count($arguments); $fromIndex += 2) {
            $toIndex = $fromIndex + 1;
            if ($toIndex >= count($arguments)) {
                break;
            }

            $from = $this->sanitise($arguments[$fromIndex]);
            $to   = $this->sanitise($arguments[$toIndex]);

            $value .= $from . '-' . $to;
        }

        $value .= ']';

        return $this->add($value, $subPattern);
    }
public function range($subPattern = null)
    {
        $arguments = func_get_args();

        // odd number of arguments, must assume last is subPattern
        if (count($arguments) % 2 === 1) {
            $subPattern = array_pop($arguments);
        } else {
            $subPattern = null;
        }

        $value     = '[';

        for ($fromIndex = 0; $fromIndex < count($arguments); $fromIndex += 2) {
            $toIndex = $fromIndex + 1;
            if ($toIndex >= count($arguments)) {
                break;
            }

            $from = $this->sanitise($arguments[$fromIndex]);
            $to   = $this->sanitise($arguments[$toIndex]);

            $value .= $from . '-' . $to;
        }

        $value .= ']';

        return $this->add($value, $subPattern);
    }
public function range ( $ subPattern = null ) { $ arguments = func_get_args ( ) ; // odd number of arguments, must assume last is subPattern if ( count ( $ arguments ) % 2 === 1 ) { $ subPattern = array_pop ( $ arguments ) ; } else { $ subPattern = null ; } $ value = '[' ; for ( $ fromIndex = 0 ; $ fromIndex < count ( $ arguments ) ; $ fromIndex += 2 ) { $ toIndex = $ fromIndex + 1 ; if ( $ toIndex >= count ( $ arguments ) ) { break ; } $ from = $ this -> sanitise ( $ arguments [ $ fromIndex ] ) ; $ to = $ this -> sanitise ( $ arguments [ $ toIndex ] ) ; $ value .= $ from . '-' . $ to ; } $ value .= ']' ; return $ this -> add ( $ value , $ subPattern ) ; }
Characters in range - requires pairs of arguments, provide subPattern as final argument

@param boolean $subPattern Capture sub patterns?

@return $this
Characters in range - requires pairs of arguments provide subPattern as final argument