Exemplo n.º 1
0
 /**
  * Return regex to match xml attributes' name and value pair
  *
  * @param  string $name named group for name part
  * @param  string $value named group for value part
  * @return string
  * @access public
  * @static
  */
 public static function xmlNameValue($name = '', $value = '')
 {
     return sprintf('%s(?:\\s*+=\\s*+%s)?', Util::groupRegEx(static::xmlName(), $name), Util::groupRegEx(RegEx::quotedString(), $value));
 }
Exemplo n.º 2
0
 /**
  * Return regex to match comma seperated strings
  *
  * comma in quotes are ignored. the unrolling pattern implemented
  *
  * @param  string $char the seperate char, default ','
  * @param  int $option regex option
  * @return string
  * @access public
  * @static
  */
 public static function commaField($char = ',', $option = RegExOption::OPTION_DEFAULT)
 {
     $quoted = RegEx::quotedString($option);
     return sprintf('(?<=%s|^)[^%s"\']*(?:%s[^%s"\']*)*(?=%s|\\Z)', $char, $char, $quoted, $char, $char);
 }