protected function getEmphasisByBlock($regexp, $pos)
	{
		$block    = [];
		$blocks   = [];
		$breakPos = $this->text->indexOf("\x17", $pos);

		preg_match_all($regexp, $this->text, $matches, PREG_OFFSET_CAPTURE, $pos);
		foreach ($matches[0] as $m)
		{
			$matchPos = $m[1];
			$matchLen = strlen($m[0]);

			// Test whether we've just passed the limits of a block
			if ($matchPos > $breakPos)
			{
				$blocks[] = $block;
				$block    = [];
				$breakPos = $this->text->indexOf("\x17", $matchPos);
			}

			// Test whether we should ignore this markup
			if (!$this->ignoreEmphasis($matchPos, $matchLen))
			{
				$block[] = [$matchPos, $matchLen];
			}
		}
		$blocks[] = $block;

		return $blocks;
	}
protected function getEmphasisByBlock($regexp, $pos)
	{
		$block    = [];
		$blocks   = [];
		$breakPos = $this->text->indexOf("\x17", $pos);

		preg_match_all($regexp, $this->text, $matches, PREG_OFFSET_CAPTURE, $pos);
		foreach ($matches[0] as $m)
		{
			$matchPos = $m[1];
			$matchLen = strlen($m[0]);

			// Test whether we've just passed the limits of a block
			if ($matchPos > $breakPos)
			{
				$blocks[] = $block;
				$block    = [];
				$breakPos = $this->text->indexOf("\x17", $matchPos);
			}

			// Test whether we should ignore this markup
			if (!$this->ignoreEmphasis($matchPos, $matchLen))
			{
				$block[] = [$matchPos, $matchLen];
			}
		}
		$blocks[] = $block;

		return $blocks;
	}
protected function getEmphasisByBlock ( $ regexp , $ pos ) { $ block = [ ] ; $ blocks = [ ] ; $ breakPos = $ this -> text -> indexOf ( "\x17" , $ pos ) ; preg_match_all ( $ regexp , $ this -> text , $ matches , PREG_OFFSET_CAPTURE , $ pos ) ; foreach ( $ matches [ 0 ] as $ m ) { $ matchPos = $ m [ 1 ] ; $ matchLen = strlen ( $ m [ 0 ] ) ; // Test whether we've just passed the limits of a block if ( $ matchPos > $ breakPos ) { $ blocks [ ] = $ block ; $ block = [ ] ; $ breakPos = $ this -> text -> indexOf ( "\x17" , $ matchPos ) ; } // Test whether we should ignore this markup if ( ! $ this -> ignoreEmphasis ( $ matchPos , $ matchLen ) ) { $ block [ ] = [ $ matchPos , $ matchLen ] ; } } $ blocks [ ] = $ block ; return $ blocks ; }
Get emphasis markup split by block

@param  string  $regexp Regexp used to match emphasis
@param  integer $pos    Position in the text of the first emphasis character
@return array[]         Each array contains a list of [matchPos, matchLen] pairs
Get emphasis markup split by block