Index: Gruntfile.js
===================================================================
[1;31m--- Gruntfile.js	(revision 38086)[0;0m
[1;34m+++ Gruntfile.js	(working copy)[0;0m
[1;35m@@ -591,6 +591,36 @@[0;0m
[0;0m 				dest: '.'[0;0m
[0;0m 			}[0;0m
[0;0m 		},[0;0m
[1;34m+		replace: {[0;0m
[1;34m+			emojiRegex: {[0;0m
[1;34m+				options: {[0;0m
[1;34m+					patterns: [[0;0m
[1;34m+						{[0;0m
[1;34m+							match: /\/\/ START: emoji regex[\S\s]*\/\/ END: emoji regex/g,[0;0m
[1;34m+							replacement: function () {[0;0m
[1;34m+								var twemoji = grunt.file.read( SOURCE_DIR + 'wp-includes/js/twemoji.js' );[0;0m
[1;34m+								var found = twemoji.match( /re = \/(.*)\/g,/ );[0;0m
[1;34m+								var emojiRegex = found[1];[0;0m
[1;34m+[0;0m
[1;34m+								// Magically transform emojiRegex into a PHP-friendly regex here.[0;0m
[1;34m+[0;0m
[1;34m+								return "// START: emoji regex\n\treturn 'lol';\n\t// END: emoji regex";[0;0m
[1;34m+							}[0;0m
[1;34m+						}[0;0m
[1;34m+					][0;0m
[1;34m+				},[0;0m
[1;34m+				files: [[0;0m
[1;34m+					{[0;0m
[1;34m+						expand: true,[0;0m
[1;34m+						flatten: true,[0;0m
[1;34m+						src: [[0;0m
[1;34m+							SOURCE_DIR + 'wp-includes/formatting.php'[0;0m
[1;34m+						],[0;0m
[1;34m+						dest: SOURCE_DIR + 'wp-includes/'[0;0m
[1;34m+					}[0;0m
[1;34m+				][0;0m
[1;34m+			}[0;0m
[1;34m+		},[0;0m
[0;0m 		_watch: {[0;0m
[0;0m 			all: {[0;0m
[0;0m 				files: [[0;0m
[1;35m@@ -687,6 +717,10 @@[0;0m
[0;0m 		'phpunit'[0;0m
[0;0m 	] );[0;0m
[0;0m [0;0m
[1;34m+	grunt.registerTask( 'precommit:emoji', [[0;0m
[1;34m+		'replace:emojiRegex'[0;0m
[1;34m+	] );[0;0m
[1;34m+[0;0m
[0;0m 	grunt.registerTask( 'precommit', 'Runs test and build tasks in preparation for a commit', function() {[0;0m
[0;0m 		var done = this.async();[0;0m
[0;0m 		var map = {[0;0m
[1;35m@@ -752,6 +786,11 @@[0;0m
[0;0m 							taskList.push( 'precommit:' + extension );[0;0m
[0;0m 						}[0;0m
[0;0m 					} );[0;0m
[1;34m+[0;0m
[1;34m+					if ( [ 'twemoji.js' ].some( testPath ) ) {[0;0m
[1;34m+						grunt.log.writeln( 'twemoji.js has updated. Running `precomitt:emoji.' );[0;0m
[1;34m+						taskList.push( 'precommit:emoji' );[0;0m
[1;34m+					}[0;0m
[0;0m 				}[0;0m
[0;0m [0;0m
[0;0m 				grunt.task.run( taskList );[0;0m
Index: package.json
===================================================================
[1;31m--- package.json	(revision 38086)[0;0m
[1;34m+++ package.json	(working copy)[0;0m
[1;35m@@ -27,6 +27,7 @@[0;0m
[0;0m     "grunt-legacy-util": "^0.2.0",[0;0m
[0;0m     "grunt-patch-wordpress": "~0.4.0",[0;0m
[0;0m     "grunt-postcss": "~0.7.1",[0;0m
[1;34m+    "grunt-replace": "~1.0.1",[0;0m
[0;0m     "grunt-rtlcss": "~2.0.1",[0;0m
[0;0m     "grunt-sass": "~1.1.0",[0;0m
[0;0m     "matchdep": "~1.0.0"[0;0m
Index: src/wp-includes/formatting.php
===================================================================
[1;31m--- src/wp-includes/formatting.php	(revision 38087)[0;0m
[1;34m+++ src/wp-includes/formatting.php	(working copy)[0;0m
[1;35m@@ -5209,6 +5209,24 @@[0;0m
[0;0m }[0;0m
[0;0m [0;0m
[0;0m /**[0;0m
[1;34m+ * Returns a regex string to match all emoji that WordPress recognises.[0;0m
[1;34m+ *[0;0m
[1;34m+ * This regex is automatically built from the regex in twemoji.js - if it needs to be updated,[0;0m
[1;34m+ * you should update the regex there, then run the `grunt precommit:emoji` job.[0;0m
[1;34m+ *[0;0m
[1;34m+ * @since 4.6.0[0;0m
[1;34m+ *[0;0m
[1;34m+ * @return string A regex to match all emoji that WordPress recognises.[0;0m
[1;34m+ */[0;0m
[1;34m+function wp_emoji_regex() {[0;0m
[1;34m+	// Do not remove the START/END comments - they're used to find where to insert the regex.[0;0m
[1;34m+[0;0m
[1;34m+	// START: emoji regex[0;0m
[1;34m+	return 'lol';[0;0m
[1;34m+	// END: emoji regex[0;0m
[1;34m+}[0;0m
[1;34m+[0;0m
[1;34m+/**[0;0m
[0;0m  * Shorten a URL, to be used as link text.[0;0m
[0;0m  *[0;0m
[0;0m  * @since 1.2.0[0;0m
