public function convertSplittersToRegexPattern( $splitters ) {
	    $regex_parts = array();
	    foreach ( $splitters as $part ) {
		    $part = preg_quote( $part );

		    switch ( $part ) {
			    case "\r\n":
				    $part = '\r\n';
				    break;
			    case "\t":
				    $part = '\t';
				    break;
			    case "\n":
				    $part = '\n';
				    break;
			    case " ":
				    $part = '\s';
				    break;
			    case "/":
				    $part = "\/";
				    break;
			    case "/\*":
				    $part = "\/\*";
				    break;
			    case "\*/":
				    $part = "\*\/";
				    break;
		    }

		    $regex_parts[] = $part;
	    }

	    $pattern = implode( '|', $regex_parts );

	    return '/(' . $pattern . ')/';
    }
public function convertSplittersToRegexPattern( $splitters ) {
	    $regex_parts = array();
	    foreach ( $splitters as $part ) {
		    $part = preg_quote( $part );

		    switch ( $part ) {
			    case "\r\n":
				    $part = '\r\n';
				    break;
			    case "\t":
				    $part = '\t';
				    break;
			    case "\n":
				    $part = '\n';
				    break;
			    case " ":
				    $part = '\s';
				    break;
			    case "/":
				    $part = "\/";
				    break;
			    case "/\*":
				    $part = "\/\*";
				    break;
			    case "\*/":
				    $part = "\*\/";
				    break;
		    }

		    $regex_parts[] = $part;
	    }

	    $pattern = implode( '|', $regex_parts );

	    return '/(' . $pattern . ')/';
    }
public function convertSplittersToRegexPattern ( $ splitters ) { $ regex_parts = array ( ) ; foreach ( $ splitters as $ part ) { $ part = preg_quote ( $ part ) ; switch ( $ part ) { case "\r\n" : $ part = '\r\n' ; break ; case "\t" : $ part = '\t' ; break ; case "\n" : $ part = '\n' ; break ; case " " : $ part = '\s' ; break ; case "/" : $ part = "\/" ; break ; case "/\*" : $ part = "\/\*" ; break ; case "\*/" : $ part = "\*\/" ; break ; } $ regex_parts [ ] = $ part ; } $ pattern = implode ( '|' , $ regex_parts ) ; return '/(' . $ pattern . ')/' ; }
Convert an array of splitter tokens to a regex pattern string.

@param array $splitters

@return string
Convert an array of splitter tokens to a regex pattern string .