You are here

public static function Interval::getIntervalRegexp in Plug 7

Returns a Regexp that matches valid intervals.

Return value

string A Regexp (without the delimiters)

2 calls to Interval::getIntervalRegexp()
Interval::test in lib/Symfony/translation/Interval.php
Tests if the given number is in the math interval.
MessageSelector::choose in lib/Symfony/translation/MessageSelector.php
Given a message with different plural translations separated by a pipe (|), this method returns the correct portion of the message based on the given number, locale and the pluralization rules in the message itself.

File

lib/Symfony/translation/Interval.php, line 78

Class

Interval
Tests if a given number belongs to a given math interval.

Namespace

Symfony\Component\Translation

Code

public static function getIntervalRegexp() {
  return <<<EOF
        ({\\s*
            (\\-?\\d+(\\.\\d+)?[\\s*,\\s*\\-?\\d+(\\.\\d+)?]*)
        \\s*})

            |

        (?P<left_delimiter>[\\[\\]])
            \\s*
            (?P<left>-Inf|\\-?\\d+(\\.\\d+)?)
            \\s*,\\s*
            (?P<right>\\+?Inf|\\-?\\d+(\\.\\d+)?)
            \\s*
        (?P<right_delimiter>[\\[\\]])
EOF;
}