client/components/tinymce/plugins/after-the-deadline/core.js
function splitTextNode( textnode, regexp, replacement ) {
		let text = textnode.nodeValue,
			index = text.search( regexp ),
			match = text.match( regexp ),
			captured = [],
			cursor;

		if ( index < 0 || ! match.length ) {
			return [ textnode ];
		}

		if ( index > 0 ) {
			// capture left text node
			captured.push( document.createTextNode( text.substr( 0, index ) ) );
		}

		// capture the replacement of the matched string
		captured.push( parent.create( match[ 0 ].replace( regexp, replacement ) ) );

		cursor = index + match[ 0 ].length;

		if ( cursor < text.length ) {
			// capture right text node
			captured.push( document.createTextNode( text.substr( cursor ) ) );
		}

		return captured;
	}
function splitTextNode( textnode, regexp, replacement ) {
		let text = textnode.nodeValue,
			index = text.search( regexp ),
			match = text.match( regexp ),
			captured = [],
			cursor;

		if ( index < 0 || ! match.length ) {
			return [ textnode ];
		}

		if ( index > 0 ) {
			// capture left text node
			captured.push( document.createTextNode( text.substr( 0, index ) ) );
		}

		// capture the replacement of the matched string
		captured.push( parent.create( match[ 0 ].replace( regexp, replacement ) ) );

		cursor = index + match[ 0 ].length;

		if ( cursor < text.length ) {
			// capture right text node
			captured.push( document.createTextNode( text.substr( cursor ) ) );
		}

		return captured;
	}
Split a text node into an ordered list of siblings:
- text node to the left of the match
- the element replacing the match
- text node to the right of the match

We have to leave the text to the left and right of the match alone
in order to prevent XSS

@return array